diff --git a/package-lock.json b/package-lock.json index 895aa2e99f..837f6062a8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "Metadatamanagement", - "version": "1.0.111-HOTFIX", + "version": "1.0.112", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 56870ea547..5975a7f899 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Metadatamanagement", - "version": "1.0.111-HOTFIX", + "version": "1.0.112", "description": "Data Search for Higher Education Research and Science Studies", "private": true, "dependencies": { diff --git a/pom.xml b/pom.xml index 7891968f91..39ddcacb2b 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ eu.dzhw.fdz metadatamanagement - 1.0.111-HOTFIX + 1.0.112 war metadatamanagement @@ -143,7 +143,7 @@ org.apache.commons commons-compress - 1.20 + 1.21 org.apache.commons diff --git a/reports/cpd-report.txt b/reports/cpd-report.txt new file mode 100644 index 0000000000..69a5b466b9 --- /dev/null +++ b/reports/cpd-report.txt @@ -0,0 +1,20158 @@ +Found a 41 line (273 tokens) duplication in the following files: +Starting at line 177 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 298 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java + + public void testSimpleProjectForPostValidationWithWrongInformationForQuestion() throws IOException, Exception { + + //Arrange + //Project + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + project.getConfiguration().setDataPackagesState(new ProjectState(true, true)); + this.rdcProjectRepository.save(project); + + //DataPackage (each project must have one) + DataPackage dataPackage = UnitTestCreateDomainObjectUtils.buildDataPackage(project.getId()); + this.dataPackageRepository.save(dataPackage); + + //Survey + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); + this.surveyRepository.save(survey); + List surveyNumbers = new ArrayList<>(); + surveyNumbers.add(1); + List listOfSurveyIds = new ArrayList<>(); + listOfSurveyIds.add(survey.getId()); + + //Variables + Variable variable1 = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "name1", 1, surveyNumbers); + this.variableRepository.save(variable1); + Variable variable2 = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "name2", 2, surveyNumbers); + this.variableRepository.save(variable2); + Variable variable3 = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "name3", 3, surveyNumbers); + this.variableRepository.save(variable3); + + //DataSet + DataSet dataSet = UnitTestCreateDomainObjectUtils.buildDataSet(project.getId(), survey.getId(), 1); + this.dataSetRepository.save(dataSet); + + //Instrument + Instrument instrument = UnitTestCreateDomainObjectUtils.buildInstrument(project.getId()); + this.instrumentRepository.save(instrument); + + //Question + Question question = UnitTestCreateDomainObjectUtils.buildQuestion(project.getId(), 123, "testProject-WrongQuestionname1" +===================================================================== +Found a 16 line (256 tokens) duplication in the following files: +Starting at line 44 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 37 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSubDocument.java + + public final StringPath id = createString("id"); + + public final ListPath institutions = this.createList("institutions", eu.dzhw.fdz.metadatamanagement.common.domain.I18nString.class, eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString.class, PathInits.DIRECT2); + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + public final StringPath masterId = createString("masterId"); + + public final ListPath projectContributors = this.createList("projectContributors", eu.dzhw.fdz.metadatamanagement.common.domain.Person.class, eu.dzhw.fdz.metadatamanagement.common.domain.QPerson.class, PathInits.DIRECT2); + + //inherited + public final BooleanPath shadow = _super.shadow; +===================================================================== +Found a 33 line (229 tokens) duplication in the following files: +Starting at line 177 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 236 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 298 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java + + public void testSimpleProjectForPostValidationWithWrongInformationForQuestion() throws IOException, Exception { + + //Arrange + //Project + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + project.getConfiguration().setDataPackagesState(new ProjectState(true, true)); + this.rdcProjectRepository.save(project); + + //DataPackage (each project must have one) + DataPackage dataPackage = UnitTestCreateDomainObjectUtils.buildDataPackage(project.getId()); + this.dataPackageRepository.save(dataPackage); + + //Survey + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); + this.surveyRepository.save(survey); + List surveyNumbers = new ArrayList<>(); + surveyNumbers.add(1); + List listOfSurveyIds = new ArrayList<>(); + listOfSurveyIds.add(survey.getId()); + + //Variables + Variable variable1 = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "name1", 1, surveyNumbers); + this.variableRepository.save(variable1); + Variable variable2 = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "name2", 2, surveyNumbers); + this.variableRepository.save(variable2); + Variable variable3 = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "name3", 3, surveyNumbers); + this.variableRepository.save(variable3); + + //DataSet + DataSet dataSet = UnitTestCreateDomainObjectUtils.buildDataSet(project.getId(), survey.getId(), 1); +===================================================================== +Found a 11 line (208 tokens) duplication in the following files: +Starting at line 145 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 154 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java + + public QInstrumentSearchDocument(Class type, PathMetadata metadata, PathInits inits) { + super(type, metadata, inits); + this.completeTitle = inits.isInitialized("completeTitle") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("completeTitle")) : null; + this.configuration = inits.isInitialized("configuration") ? new eu.dzhw.fdz.metadatamanagement.projectmanagement.domain.QConfiguration(forProperty("configuration")) : null; + this.dataPackage = inits.isInitialized("dataPackage") ? new QDataPackageSubDocument(forProperty("dataPackage"), inits.get("dataPackage")) : null; + this.guiLabels = inits.isInitialized("guiLabels") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("guiLabels")) : null; + this.nestedDataPackage = inits.isInitialized("nestedDataPackage") ? new QDataPackageNestedDocument(forProperty("nestedDataPackage"), inits.get("nestedDataPackage")) : null; + this.release = inits.isInitialized("release") ? new eu.dzhw.fdz.metadatamanagement.projectmanagement.domain.QRelease(forProperty("release")) : null; + } + +} +===================================================================== +Found a 34 line (206 tokens) duplication in the following files: +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 29 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java + + public final eu.dzhw.fdz.metadatamanagement.instrumentmanagement.domain.QInstrument _super = new eu.dzhw.fdz.metadatamanagement.instrumentmanagement.domain.QInstrument(this); + + // custom + // inherited + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(_super.annotations); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString completeTitle; + + //inherited + public final ListPath conceptIds = _super.conceptIds; + + public final ListPath concepts = this.createList("concepts", ConceptSubDocument.class, QConceptSubDocument.class, PathInits.DIRECT2); + + public final eu.dzhw.fdz.metadatamanagement.projectmanagement.domain.QConfiguration configuration; + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + //inherited + public final StringPath dataAcquisitionProjectId = _super.dataAcquisitionProjectId; + + public final QDataPackageSubDocument dataPackage; + + //inherited + public final StringPath dataPackageId = _super.dataPackageId; + + public final ListPath dataSets = this.createList("dataSets", DataSetSubDocument.class, QDataSetSubDocument.class, PathInits.DIRECT2); + + // custom + // inherited + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString description = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(_super.description); +===================================================================== +Found a 58 line (156 tokens) duplication in the following files: +Starting at line 150 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageOverviewService.java +Starting at line 245 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetReportService.java + + missingTexFiles.add(KEY_MAIN); + } + + return missingTexFiles; + } + + /** + * This method fills the tex templates. + * + * @param templateContent The content of a tex template. + * @param templateConfiguration The configuration for freemarker. + * @param fileName filename of the script which will be filled in this method. + * @return The filled tex templates as byte array. + * @throws IOException Handles IO Exception. + * @throws TemplateException Handles template Exceptions. + */ + private String fillTemplate(String templateContent, Configuration templateConfiguration, + Map dataForTemplate, String fileName) throws IOException, TemplateException { + String templateName = "texTemplate"; + if (fileName != null && fileName.trim().length() > 0) { + templateName = fileName; + } + + // Read Template and escape elements + Template texTemplate = new Template(templateName, + ESCAPE_PREFIX + templateContent + ESCAPE_SUFFIX, templateConfiguration); + + try (Writer stringWriter = new StringWriter()) { + texTemplate.process(dataForTemplate, stringWriter); + + stringWriter.flush(); + return stringWriter.toString(); + } + } + + /** + * This method save a latex file into GridFS/MongoDB based on a byteArrayOutputStream. + * + * @param fileName The name of the file to be saved + * @return return the file name of the saved latex template in the GridFS / MongoDB. + * @throws IOException thrown if a stream cannot be closed + */ + @SuppressFBWarnings("OBL_UNSATISFIED_OBLIGATION") + private String saveCompleteZipFile(File zipFile, String fileName) throws IOException { + // No Update by API, so we have to delete first. + fileService.deleteTempFile(fileName); + // Save tex file + return fileService.saveTempFile(new FileInputStream(zipFile), fileName, CONTENT_TYPE_ZIP); + } + + /** + * This method load all needed objects from the db for filling the tex template. + * + * @param dataPackageId the id of the data package. + * @return A HashMap with all data for the template filling. The Key is the name of the Object, + * which is used in the template. + */ + private Map loadDataForTemplateFilling(String dataPackageId) { +===================================================================== +Found a 36 line (153 tokens) duplication in the following files: +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetNestedDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentNestedDocument.java + + public static final QDataSetNestedDocument dataSetNestedDocument = new QDataSetNestedDocument("dataSetNestedDocument"); + + public final QAbstractNestedSubDocument _super; + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString completeTitle; + + //inherited + public final StringPath createdBy; + + //inherited + public final DateTimePath createdDate; + + public final StringPath dataPackageId = createString("dataPackageId"); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString description; + + public final StringPath id = createString("id"); + + //inherited + public final StringPath lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate; + + public final StringPath masterId = createString("masterId"); + + public final BooleanPath shadow = createBoolean("shadow"); + + public final StringPath successorId = createString("successorId"); + + public final ListPath surveyIds = this.createList("surveyIds", String.class, StringPath.class, PathInits.DIRECT2); + + //inherited + public final NumberPath version; + + public QDataSetNestedDocument(String variable) { +===================================================================== +Found a 7 line (147 tokens) duplication in the following files: +Starting at line 145 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 164 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 154 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java + + public QInstrumentSearchDocument(Class type, PathMetadata metadata, PathInits inits) { + super(type, metadata, inits); + this.completeTitle = inits.isInitialized("completeTitle") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("completeTitle")) : null; + this.configuration = inits.isInitialized("configuration") ? new eu.dzhw.fdz.metadatamanagement.projectmanagement.domain.QConfiguration(forProperty("configuration")) : null; + this.dataPackage = inits.isInitialized("dataPackage") ? new QDataPackageSubDocument(forProperty("dataPackage"), inits.get("dataPackage")) : null; + this.guiLabels = inits.isInitialized("guiLabels") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("guiLabels")) : null; + this.nestedDataPackage = inits.isInitialized("nestedDataPackage") ? new QDataPackageNestedDocument(forProperty("nestedDataPackage"), inits.get("nestedDataPackage")) : null; +===================================================================== +Found a 23 line (146 tokens) duplication in the following files: +Starting at line 29 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java +Starting at line 32 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(_super.annotations); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString completeTitle; + + public final ListPath concepts = this.createList("concepts", ConceptSubDocument.class, QConceptSubDocument.class, PathInits.DIRECT2); + + public final eu.dzhw.fdz.metadatamanagement.projectmanagement.domain.QConfiguration configuration; + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + //inherited + public final StringPath dataAcquisitionProjectId = _super.dataAcquisitionProjectId; + + public final QDataPackageSubDocument dataPackage; + + //inherited + public final StringPath dataPackageId = _super.dataPackageId; + + public final ListPath dataSets = this.createList("dataSets", DataSetSubDocument.class, QDataSetSubDocument.class, PathInits.DIRECT2); +===================================================================== +Found a 23 line (145 tokens) duplication in the following files: +Starting at line 119 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 152 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java + + public void testDeleteSingleAttachment() throws Exception { + + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); + DataSetAttachmentMetadata dataSetAttachmentMetadata = + UnitTestCreateDomainObjectUtils.buildDataSetAttachmentMetadata("projectid", 1); + MockMultipartFile metadata = new MockMultipartFile("dataSetAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(dataSetAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/data-sets/attachments").file(attachment) + .file(metadata)).andExpect(status().isCreated()); + + dataSetAttachmentMetadata.generateId(); + + // ensure that there is one attachment + mockMvc + .perform(get("/api/data-sets/" + dataSetAttachmentMetadata.getDataSetId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(1)));; + + // delete the file + mockMvc + .perform(delete("/api/data-sets/" + dataSetAttachmentMetadata.getDataSetId() + + "/attachments/" + attachment.getOriginalFilename())) +===================================================================== +Found a 22 line (143 tokens) duplication in the following files: +Starting at line 109 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 141 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java + + public void testDeleteSingleAttachment() throws Exception { + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); + ConceptAttachmentMetadata conceptAttachmentMetadata = + UnitTestCreateDomainObjectUtils.buildConceptAttachmentMetadata("con-conceptid$"); + MockMultipartFile metadata = new MockMultipartFile("conceptAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(conceptAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/concepts/attachments").file(attachment) + .file(metadata)).andExpect(status().isCreated()); + + conceptAttachmentMetadata.generateId(); + + // ensure that there is one file + mockMvc + .perform(get("/api/concepts/" + conceptAttachmentMetadata.getConceptId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(1))); + + // delete the file + mockMvc + .perform(delete("/api/concepts/" + conceptAttachmentMetadata.getConceptId() + + "/attachments/" + attachment.getOriginalFilename())) +===================================================================== +Found a 23 line (143 tokens) duplication in the following files: +Starting at line 119 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 152 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java + + public void testDeleteAttachment() throws Exception { + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); + DataPackageAttachmentMetadata dataPackageAttachmentMetadata = + UnitTestCreateDomainObjectUtils.buildDataPackageAttachmentMetadata("projectid"); + MockMultipartFile metadata = new MockMultipartFile("dataPackageAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(dataPackageAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/data-packages/attachments") + .file(attachment).file(metadata)).andExpect(status().isCreated()); + + dataPackageAttachmentMetadata.generateId(); + + // ensure that there is one attachment + mockMvc + .perform(get("/api/data-packages/" + dataPackageAttachmentMetadata.getDataPackageId() + + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(1))); + + // delete the file + mockMvc + .perform(delete("/api/data-packages/" + dataPackageAttachmentMetadata.getDataPackageId() + + "/attachments/" + attachment.getOriginalFilename())) +===================================================================== +Found a 17 line (143 tokens) duplication in the following files: +Starting at line 244 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 270 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + variable.setScaleLevel(ScaleLevels.ORDINAL); + List validResponses = new ArrayList<>(); + variable.getDistribution().setValidResponses(validResponses); + variable.getDistribution().getStatistics().setMaximum("2017-01-31"); + variable.getDistribution().getStatistics().setMinimum("2017-01-30"); + variable.getDistribution().getStatistics().setMedian("2017-01-30"); + variable.getDistribution().getStatistics().setThirdQuartile("2017-01-31"); + variable.getDistribution().getStatistics().setFirstQuartile("2017-01-30"); + + // create the variable with a survey but without a project + mockMvc.perform(put(API_VARIABLES_URI + "/" + variable.getId()) + .content(TestUtil.convertObjectToJsonBytes(variable)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); + } + + @Test + public void testCreateDateVariableWithNominalScaleLevel() throws Exception { +===================================================================== +Found a 7 line (143 tokens) duplication in the following files: +Starting at line 21 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/domain/QConcept.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSubDocument.java + + public static final QConcept concept = new QConcept("concept"); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractRdcDomainObject _super = new eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractRdcDomainObject(this); + + public final ListPath authors = this.createList("authors", eu.dzhw.fdz.metadatamanagement.common.domain.Person.class, eu.dzhw.fdz.metadatamanagement.common.domain.QPerson.class, PathInits.DIRECT2); + + public final StringPath citationHint = createString("citationHint"); +===================================================================== +Found a 18 line (140 tokens) duplication in the following files: +Starting at line 170 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 196 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java + + DataPackage dataPackage = UnitTestCreateDomainObjectUtils.buildDataPackage(project.getId()); + + // create the dataPackage with the given id + mockMvc.perform(put(API_DATAPACKAGE_URI + "/" + dataPackage.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataPackage)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); + + // release the project + project.setRelease(UnitTestCreateDomainObjectUtils.buildRelease()); + project.getRelease().setPinToStartPage(true); + mockMvc.perform(put("/api/data-acquisition-projects" + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isNoContent()); + shadowCopyQueueItemService.executeShadowCopyActions(); + + UnitTestUserManagementUtils.logout(); + // ensure that there is one pinned data package + mockMvc.perform(get(API_DATAPACKAGE_URI + "?pinned=true")).andExpect(status().isOk()) +===================================================================== +Found a 21 line (140 tokens) duplication in the following files: +Starting at line 101 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 177 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java + + public void testDeleteSingleAttachment() throws Exception { + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); + InstrumentAttachmentMetadata instrumentAttachmentMetadata = + UnitTestCreateDomainObjectUtils.buildInstrumentAttachmentMetadata("projectid", 1); + MockMultipartFile metadata = new MockMultipartFile("instrumentAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(instrumentAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/instruments/attachments") + .file(attachment).file(metadata)).andExpect(status().isCreated()); + + // ensure the uploaded file exists + mockMvc + .perform(get( + "/api/instruments/" + instrumentAttachmentMetadata.getInstrumentId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(1))); + + // delete the file + mockMvc + .perform(delete("/api/instruments/" + instrumentAttachmentMetadata.getInstrumentId() + + "/attachments/" + attachment.getOriginalFilename())) +===================================================================== +Found a 18 line (140 tokens) duplication in the following files: +Starting at line 116 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 143 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + public void testDeleteSingleAttachment() throws Exception { + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); + SurveyAttachmentMetadata surveyAttachmentMetadata = + UnitTestCreateDomainObjectUtils.buildSurveyAttachmentMetadata("projectid", 1); + MockMultipartFile metadata = new MockMultipartFile("surveyAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(surveyAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/surveys/attachments").file(attachment) + .file(metadata)).andExpect(status().isCreated()); + + // ensure that there is one attachment + mockMvc.perform(get("/api/surveys/" + surveyAttachmentMetadata.getSurveyId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(1)));; + + // delete the file + mockMvc.perform(delete("/api/surveys/" + surveyAttachmentMetadata.getSurveyId() + + "/attachments/" + attachment.getOriginalFilename())) +===================================================================== +Found a 22 line (140 tokens) duplication in the following files: +Starting at line 126 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResponseRateImageResourceTest.java +Starting at line 156 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResponseRateImageResourceTest.java + + public void testDeleteAllResponseRateImages() throws Exception { + MockMultipartFile attachment = + new MockMultipartFile("image", FILE_NAME, "image/png", "fakeimage".getBytes()); + SurveyResponseRateImageMetadata surveyResponseRateImageMetadata = + createResponseRateImageMetadata(); + MockMultipartFile metadata = new MockMultipartFile("surveyResponseRateImageMetadata", FILE_NAME, + "application/json", TestUtil.convertObjectToJsonBytes(surveyResponseRateImageMetadata)); + + // create the image + MvcResult result = mockMvc + .perform( + MockMvcRequestBuilders.multipart("/api/surveys/images").file(attachment).file(metadata)) + .andExpect(status().isCreated()).andReturn(); + + // assert that the file exists + String fileUri = result.getResponse().getHeaderValue(HttpHeaders.LOCATION).toString(); + mockMvc.perform(get(fileUri)).andExpect(status().isOk()); + + // delete all images + mockMvc + .perform( + delete("/api/surveys/" + surveyResponseRateImageMetadata.getSurveyId() + "/images")) +===================================================================== +Found a 19 line (140 tokens) duplication in the following files: +Starting at line 21 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/domain/QTags.java +Starting at line 21 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QTags.java + + public static final QTags tags = new QTags("tags"); + + public final SetPath de = this.createSet("de", String.class, StringPath.class, PathInits.DIRECT2); + + public final SetPath en = this.createSet("en", String.class, StringPath.class, PathInits.DIRECT2); + + public QTags(String variable) { + super(Tags.class, forVariable(variable)); + } + + public QTags(Path path) { + super(path.getType(), path.getMetadata()); + } + + public QTags(PathMetadata metadata) { + super(Tags.class, metadata); + } + +} +===================================================================== +Found a 23 line (140 tokens) duplication in the following files: +Starting at line 36 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 40 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 33 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java + + public final ListPath concepts = this.createList("concepts", ConceptSubDocument.class, QConceptSubDocument.class, PathInits.DIRECT2); + + public final eu.dzhw.fdz.metadatamanagement.projectmanagement.domain.QConfiguration configuration; + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + //inherited + public final StringPath dataAcquisitionProjectId = _super.dataAcquisitionProjectId; + + public final QDataPackageSubDocument dataPackage; + + //inherited + public final StringPath dataPackageId = _super.dataPackageId; + + public final ListPath dataSets = this.createList("dataSets", DataSetSubDocument.class, QDataSetSubDocument.class, PathInits.DIRECT2); + + // custom + // inherited + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString description = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(_super.description); +===================================================================== +Found a 23 line (135 tokens) duplication in the following files: +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java + + public final ListPath accessWays = this.createList("accessWays", String.class, StringPath.class, PathInits.DIRECT2); + + // custom + // inherited + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(_super.annotations); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString completeTitle; + + public final ListPath concepts = this.createList("concepts", ConceptSubDocument.class, QConceptSubDocument.class, PathInits.DIRECT2); + + public final eu.dzhw.fdz.metadatamanagement.projectmanagement.domain.QConfiguration configuration; + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + //inherited + public final StringPath dataAcquisitionProjectId = _super.dataAcquisitionProjectId; + + //inherited + public final ListPath dataCurators = _super.dataCurators; +===================================================================== +Found a 13 line (134 tokens) duplication in the following files: +Starting at line 244 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 270 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 298 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + variable.setScaleLevel(ScaleLevels.ORDINAL); + List validResponses = new ArrayList<>(); + variable.getDistribution().setValidResponses(validResponses); + variable.getDistribution().getStatistics().setMaximum("2017-01-31"); + variable.getDistribution().getStatistics().setMinimum("2017-01-30"); + variable.getDistribution().getStatistics().setMedian("2017-01-30"); + variable.getDistribution().getStatistics().setThirdQuartile("2017-01-31"); + variable.getDistribution().getStatistics().setFirstQuartile("2017-01-30"); + + // create the variable with a survey but without a project + mockMvc.perform(put(API_VARIABLES_URI + "/" + variable.getId()) + .content(TestUtil.convertObjectToJsonBytes(variable)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); +===================================================================== +Found a 13 line (134 tokens) duplication in the following files: +Starting at line 64 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptNestedDocument.java +Starting at line 70 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageNestedDocument.java + + public QConceptNestedDocument(Class type, PathMetadata metadata, PathInits inits) { + super(type, metadata, inits); + this._super = new QAbstractNestedSubDocument(type, metadata, inits); + this.completeTitle = inits.isInitialized("completeTitle") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("completeTitle")) : null; + this.createdBy = _super.createdBy; + this.createdDate = _super.createdDate; + this.lastModifiedBy = _super.lastModifiedBy; + this.lastModifiedDate = _super.lastModifiedDate; + this.title = inits.isInitialized("title") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("title")) : null; + this.version = _super.version; + } + +} +===================================================================== +Found a 10 line (134 tokens) duplication in the following files: +Starting at line 72 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 88 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java + + public final ListPath nestedInstruments = this.createList("nestedInstruments", InstrumentNestedDocument.class, QInstrumentNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedQuestions = this.createList("nestedQuestions", QuestionNestedDocument.class, QQuestionNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedSurveys = this.createList("nestedSurveys", SurveyNestedDocument.class, QSurveyNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedVariables = this.createList("nestedVariables", VariableNestedDocument.class, QVariableNestedDocument.class, PathInits.DIRECT2); + + //inherited + public final SetPath originalLanguages = _super.originalLanguages; +===================================================================== +Found a 19 line (134 tokens) duplication in the following files: +Starting at line 31 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 32 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(_super.annotations); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString completeTitle; + + public final ListPath concepts = this.createList("concepts", ConceptSubDocument.class, QConceptSubDocument.class, PathInits.DIRECT2); + + public final eu.dzhw.fdz.metadatamanagement.projectmanagement.domain.QConfiguration configuration; + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + //inherited + public final StringPath dataAcquisitionProjectId = _super.dataAcquisitionProjectId; + + //inherited + public final ListPath dataCurators = _super.dataCurators; +===================================================================== +Found a 13 line (134 tokens) duplication in the following files: +Starting at line 74 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetNestedDocument.java +Starting at line 74 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentNestedDocument.java + + public QDataSetNestedDocument(Class type, PathMetadata metadata, PathInits inits) { + super(type, metadata, inits); + this._super = new QAbstractNestedSubDocument(type, metadata, inits); + this.completeTitle = inits.isInitialized("completeTitle") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("completeTitle")) : null; + this.createdBy = _super.createdBy; + this.createdDate = _super.createdDate; + this.description = inits.isInitialized("description") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("description")) : null; + this.lastModifiedBy = _super.lastModifiedBy; + this.lastModifiedDate = _super.lastModifiedDate; + this.version = _super.version; + } + +} +===================================================================== +Found a 16 line (132 tokens) duplication in the following files: +Starting at line 94 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 128 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java + + mockMvc.perform(put(API_INSTRUMENTS_URI + "/" + instrument.getId()) + .content(TestUtil.convertObjectToJsonBytes(instrument)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); + + elasticsearchUpdateQueueService.processAllQueueItems(); + + // check that there is one instrument document + assertThat(elasticsearchAdminService.countAllDocuments(), equalTo(1L)); + + // check that auditing attributes have been set + mockMvc.perform(get(API_INSTRUMENTS_URI + "/" + instrument.getId())) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.createdDate", not(isEmptyOrNullString()))) + .andExpect(jsonPath("$.lastModifiedDate", not(isEmptyOrNullString()))) + .andExpect(jsonPath("$.createdBy", is("test"))) + .andExpect(jsonPath("$.lastModifiedBy", is("test"))); +===================================================================== +Found a 16 line (132 tokens) duplication in the following files: +Starting at line 98 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 130 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java + + mockMvc.perform(put(API_QUESTIONS_URI + "/" + question.getId()) + .content(TestUtil.convertObjectToJsonBytes(question)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); + + elasticsearchUpdateQueueService.processAllQueueItems(); + + // check that there is one question documents + assertThat(elasticsearchAdminService.countAllDocuments(), equalTo(1L)); + + // check that auditing attributes have been set + mockMvc.perform(get(API_QUESTIONS_URI + "/" + question.getId())) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.createdDate", not(isEmptyOrNullString()))) + .andExpect(jsonPath("$.lastModifiedDate", not(isEmptyOrNullString()))) + .andExpect(jsonPath("$.createdBy", is("user"))) + .andExpect(jsonPath("$.lastModifiedBy", is("user"))); +===================================================================== +Found a 15 line (132 tokens) duplication in the following files: +Starting at line 114 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 146 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + mockMvc.perform(put(API_VARIABLES_URI + "/" + variable.getId()) + .content(TestUtil.convertObjectToJsonBytes(variable)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); + + queueService.processAllQueueItems(); + + // check that there is one variable search document + assertThat(elasticsearchAdminService.countAllDocuments(), equalTo(1L)); + + // check that auditing attributes have been set + mockMvc.perform(get(API_VARIABLES_URI + "/" + variable.getId())).andExpect(status().isOk()) + .andExpect(jsonPath("$.createdDate", not(isEmptyOrNullString()))) + .andExpect(jsonPath("$.lastModifiedDate", not(isEmptyOrNullString()))) + .andExpect(jsonPath("$.createdBy", is("user"))) + .andExpect(jsonPath("$.lastModifiedBy", is("user"))); +===================================================================== +Found a 18 line (131 tokens) duplication in the following files: +Starting at line 119 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 152 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 185 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java + + public void testDeleteSingleAttachment() throws Exception { + + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); + DataSetAttachmentMetadata dataSetAttachmentMetadata = + UnitTestCreateDomainObjectUtils.buildDataSetAttachmentMetadata("projectid", 1); + MockMultipartFile metadata = new MockMultipartFile("dataSetAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(dataSetAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/data-sets/attachments").file(attachment) + .file(metadata)).andExpect(status().isCreated()); + + dataSetAttachmentMetadata.generateId(); + + // ensure that there is one attachment + mockMvc + .perform(get("/api/data-sets/" + dataSetAttachmentMetadata.getDataSetId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(1)));; +===================================================================== +Found a 17 line (129 tokens) duplication in the following files: +Starting at line 109 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 141 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 173 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java + + public void testDeleteSingleAttachment() throws Exception { + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); + ConceptAttachmentMetadata conceptAttachmentMetadata = + UnitTestCreateDomainObjectUtils.buildConceptAttachmentMetadata("con-conceptid$"); + MockMultipartFile metadata = new MockMultipartFile("conceptAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(conceptAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/concepts/attachments").file(attachment) + .file(metadata)).andExpect(status().isCreated()); + + conceptAttachmentMetadata.generateId(); + + // ensure that there is one file + mockMvc + .perform(get("/api/concepts/" + conceptAttachmentMetadata.getConceptId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(1))); +===================================================================== +Found a 18 line (129 tokens) duplication in the following files: +Starting at line 119 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 152 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 185 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java + + public void testDeleteAttachment() throws Exception { + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); + DataPackageAttachmentMetadata dataPackageAttachmentMetadata = + UnitTestCreateDomainObjectUtils.buildDataPackageAttachmentMetadata("projectid"); + MockMultipartFile metadata = new MockMultipartFile("dataPackageAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(dataPackageAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/data-packages/attachments") + .file(attachment).file(metadata)).andExpect(status().isCreated()); + + dataPackageAttachmentMetadata.generateId(); + + // ensure that there is one attachment + mockMvc + .perform(get("/api/data-packages/" + dataPackageAttachmentMetadata.getDataPackageId() + + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(1))); +===================================================================== +Found a 19 line (128 tokens) duplication in the following files: +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QDataSet.java +Starting at line 20 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QSurvey.java + + public static final QDataSet dataSet = new QDataSet("dataSet"); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractShadowableRdcDomainObject _super = new eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractShadowableRdcDomainObject(this); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("annotations")); + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + public final StringPath dataAcquisitionProjectId = createString("dataAcquisitionProjectId"); + + public final StringPath dataPackageId = createString("dataPackageId"); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString description = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("description")); +===================================================================== +Found a 16 line (126 tokens) duplication in the following files: +Starting at line 101 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 133 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 177 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java + + public void testDeleteSingleAttachment() throws Exception { + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); + InstrumentAttachmentMetadata instrumentAttachmentMetadata = + UnitTestCreateDomainObjectUtils.buildInstrumentAttachmentMetadata("projectid", 1); + MockMultipartFile metadata = new MockMultipartFile("instrumentAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(instrumentAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/instruments/attachments") + .file(attachment).file(metadata)).andExpect(status().isCreated()); + + // ensure the uploaded file exists + mockMvc + .perform(get( + "/api/instruments/" + instrumentAttachmentMetadata.getInstrumentId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(1))); +===================================================================== +Found a 14 line (126 tokens) duplication in the following files: +Starting at line 116 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 143 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 170 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + public void testDeleteSingleAttachment() throws Exception { + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); + SurveyAttachmentMetadata surveyAttachmentMetadata = + UnitTestCreateDomainObjectUtils.buildSurveyAttachmentMetadata("projectid", 1); + MockMultipartFile metadata = new MockMultipartFile("surveyAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(surveyAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/surveys/attachments").file(attachment) + .file(metadata)).andExpect(status().isCreated()); + + // ensure that there is one attachment + mockMvc.perform(get("/api/surveys/" + surveyAttachmentMetadata.getSurveyId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(1)));; +===================================================================== +Found a 17 line (126 tokens) duplication in the following files: +Starting at line 87 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResponseRateImageResourceTest.java +Starting at line 126 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResponseRateImageResourceTest.java +Starting at line 156 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResponseRateImageResourceTest.java + + public void testCreateSurveyResponseRateImageMetadata() throws Exception { + MockMultipartFile attachment = + new MockMultipartFile("image", FILE_NAME, "image/png", "fakeimage".getBytes()); + SurveyResponseRateImageMetadata surveyResponseRateImageMetadata = + createResponseRateImageMetadata(); + MockMultipartFile metadata = new MockMultipartFile("surveyResponseRateImageMetadata", FILE_NAME, + "application/json", TestUtil.convertObjectToJsonBytes(surveyResponseRateImageMetadata)); + + // create the image + MvcResult result = mockMvc + .perform( + MockMvcRequestBuilders.multipart("/api/surveys/images").file(attachment).file(metadata)) + .andExpect(status().isCreated()).andReturn(); + + // assert that the file exists + String fileUri = result.getResponse().getHeaderValue(HttpHeaders.LOCATION).toString(); + mockMvc.perform(get(fileUri)).andExpect(status().isOk()); +===================================================================== +Found a 18 line (125 tokens) duplication in the following files: +Starting at line 79 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageOverviewService.java +Starting at line 131 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetReportService.java + + log.debug("Start generating report for {} and dataPackageId {}", originalName, dataPackageId); + try { + // Configuration, based on Freemarker Version 2.3.23 + Configuration templateConfiguration = new Configuration(Configuration.VERSION_2_3_23); + templateConfiguration.setDefaultEncoding(StandardCharsets.UTF_8.toString()); + templateConfiguration.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); + templateConfiguration.setNumberFormat("0.######"); + log.debug("Prepare Zip enviroment config"); + // Prepare Zip enviroment config + Map env = new HashMap<>(); + env.put("create", "true"); + env.put("encoding", StandardCharsets.UTF_8.name()); + // Create tmp file + URI uriOfZipFile = URI.create("jar:" + zipTmpFilePath.toUri()); + try (FileSystem zipFileSystem = FileSystems.newFileSystem(uriOfZipFile, env);) { + // Check missing files. + log.debug("Check missing files."); + List missingTexFiles = this.validateDataPackageOverviewStructure(zipFileSystem); +===================================================================== +Found a 21 line (123 tokens) duplication in the following files: +Starting at line 90 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 119 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 152 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 185 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java + + public void testUploadValidAttachment() throws Exception { + + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); + DataSetAttachmentMetadata dataSetAttachmentMetadata = UnitTestCreateDomainObjectUtils + .buildDataSetAttachmentMetadata("projectid", 1); + MockMultipartFile metadata = new MockMultipartFile("dataSetAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(dataSetAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/data-sets/attachments") + .file(attachment) + .file(metadata)) + .andExpect(status().isCreated()); + + dataSetAttachmentMetadata.generateId(); + + // read the created attachment and check the version + mockMvc.perform( + get("/api/data-sets/" + dataSetAttachmentMetadata.getDataSetId() + "/attachments")) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.[0].dataSetId", is(dataSetAttachmentMetadata.getDataSetId()))) +===================================================================== +Found a 21 line (123 tokens) duplication in the following files: +Starting at line 270 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 387 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java + + surveyIds.add(project.getId() + "-WrongSurveyId"); + dataSet.setSurveyIds(surveyIds); + this.dataSetRepository.save(dataSet); + + //Instrument + Instrument instrument = UnitTestCreateDomainObjectUtils.buildInstrument(project.getId()); + this.instrumentRepository.save(instrument); + + //Atomic Question + Question question = UnitTestCreateDomainObjectUtils.buildQuestion(project.getId(), 123, instrument.getId() + ); + this.questionRepository.save(question); + QuestionImageMetadata questionImageMetadata = + UnitTestCreateDomainObjectUtils.buildQuestionImageMetadata(project.getId(), question.getId()); + UnitTestImageHelper.saveQuestionImage(this.questionImageService, questionImageMetadata); + + + // Act & Assert + mockMvc.perform(post(API_DATA_ACQUISITION_PROJECTS_POST_VALIDATION_URI)) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.errors", hasSize(4))) +===================================================================== +Found a 21 line (121 tokens) duplication in the following files: +Starting at line 79 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 109 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 141 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 173 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java + + public void testUploadValidAttachment() throws Exception { + + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); + ConceptAttachmentMetadata conceptAttachmentMetadata = UnitTestCreateDomainObjectUtils + .buildConceptAttachmentMetadata("con-conceptid$"); + MockMultipartFile metadata = new MockMultipartFile("conceptAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(conceptAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/concepts/attachments") + .file(attachment) + .file(metadata)) + .andExpect(status().isCreated()); + + conceptAttachmentMetadata.generateId(); + + // read the created attachment and check the version + mockMvc.perform( + get("/api/concepts/" + conceptAttachmentMetadata.getConceptId() + "/attachments")) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.[0].conceptId", is(conceptAttachmentMetadata.getConceptId()))) +===================================================================== +Found a 21 line (121 tokens) duplication in the following files: +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 119 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 152 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 185 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java + + public void testUploadValidAttachment() throws Exception { + + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); + DataPackageAttachmentMetadata dataPackageAttachmentMetadata = + UnitTestCreateDomainObjectUtils.buildDataPackageAttachmentMetadata("projectid"); + MockMultipartFile metadata = new MockMultipartFile("dataPackageAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(dataPackageAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/data-packages/attachments") + .file(attachment).file(metadata)).andExpect(status().isCreated()); + + dataPackageAttachmentMetadata.generateId(); + + // read the created attachment and check the version + mockMvc + .perform(get("/api/data-packages/" + + dataPackageAttachmentMetadata.getDataPackageId() + "/attachments")) + .andExpect(status().isOk()) + .andExpect( + jsonPath("$.[0].dataPackageId", is(dataPackageAttachmentMetadata.getDataPackageId()))) +===================================================================== +Found a 15 line (121 tokens) duplication in the following files: +Starting at line 218 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java +Starting at line 218 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java +Starting at line 222 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java +Starting at line 215 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java + + String filename = DataPackageAttachmentFilenameBuilder.buildFileName(metadata); + gridFsMetadataUpdateService.store(is, filename, "text/plain", metadata); + is.close(); + } + + private void assertExpectedFilesExistence(List expectedFiles) { + Iterator it = gridFsOperations.find(new Query()).iterator(); + List fileNames = new ArrayList<>(); + while (it.hasNext()) { + fileNames.add(it.next().getFilename()); + } + assertThat(fileNames.size(), equalTo(expectedFiles.size())); + assertThat(fileNames, containsInAnyOrder(expectedFiles.toArray())); + } +} +===================================================================== +Found a 4 line (121 tokens) duplication in the following files: +Starting at line 61 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 53 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSubDocument.java + + public final ListPath sponsors = this.createList("sponsors", eu.dzhw.fdz.metadatamanagement.common.domain.I18nString.class, eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString.class, PathInits.DIRECT2); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString studySeries = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("studySeries")); +===================================================================== +Found a 19 line (118 tokens) duplication in the following files: +Starting at line 74 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 101 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 133 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 177 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java + + public void testUploadValidAttachment() throws Exception { + + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); + InstrumentAttachmentMetadata instrumentAttachmentMetadata = + UnitTestCreateDomainObjectUtils.buildInstrumentAttachmentMetadata("projectid", 1); + MockMultipartFile metadata = new MockMultipartFile("instrumentAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(instrumentAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/instruments/attachments") + .file(attachment).file(metadata)).andExpect(status().isCreated()); + + // read the created attachment and check the version + mockMvc + .perform(get( + "/api/instruments/" + instrumentAttachmentMetadata.getInstrumentId() + "/attachments")) + .andExpect(status().isOk()) + .andExpect( + jsonPath("$.[0].instrumentId", is(instrumentAttachmentMetadata.getInstrumentId()))) +===================================================================== +Found a 18 line (118 tokens) duplication in the following files: +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 116 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 143 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 170 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + public void testUploadValidAttachment() throws Exception { + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); + SurveyAttachmentMetadata surveyAttachmentMetadata = UnitTestCreateDomainObjectUtils + .buildSurveyAttachmentMetadata("projectid", 1); + MockMultipartFile metadata = new MockMultipartFile("surveyAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(surveyAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/surveys/attachments") + .file(attachment) + .file(metadata)) + .andExpect(status().isCreated()); + + // read the created attachment and check the version + mockMvc.perform( + get("/api/surveys/" + surveyAttachmentMetadata.getSurveyId() + "/attachments")) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.[0].surveyId", is(surveyAttachmentMetadata.getSurveyId()))) +===================================================================== +Found a 19 line (117 tokens) duplication in the following files: +Starting at line 146 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 186 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java + + public void testUpdateInstrument() throws Exception { + // Arrange + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + this.dataAcquisitionProjectRepository.save(project); + + Instrument instrument = + UnitTestCreateDomainObjectUtils.buildInstrument(project.getId(), project.getId() + "-sy1"); + + // Act and Assert + // create the instrument with the given id + mockMvc.perform(put(API_INSTRUMENTS_URI + "/" + instrument.getId()) + .content(TestUtil.convertObjectToJsonBytes(instrument)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); + + // delete the survey + mockMvc.perform(delete(API_INSTRUMENTS_URI + "/" + instrument.getId())) + .andExpect(status().is2xxSuccessful()); + + instrument.setTitle(new I18nString("Hurz2", "Hurz2")); +===================================================================== +Found a 20 line (117 tokens) duplication in the following files: +Starting at line 271 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 330 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 388 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java + + dataSet.setSurveyIds(surveyIds); + this.dataSetRepository.save(dataSet); + + //Instrument + Instrument instrument = UnitTestCreateDomainObjectUtils.buildInstrument(project.getId()); + this.instrumentRepository.save(instrument); + + //Atomic Question + Question question = UnitTestCreateDomainObjectUtils.buildQuestion(project.getId(), 123, instrument.getId() + ); + this.questionRepository.save(question); + QuestionImageMetadata questionImageMetadata = + UnitTestCreateDomainObjectUtils.buildQuestionImageMetadata(project.getId(), question.getId()); + UnitTestImageHelper.saveQuestionImage(this.questionImageService, questionImageMetadata); + + + // Act & Assert + mockMvc.perform(post(API_DATA_ACQUISITION_PROJECTS_POST_VALIDATION_URI)) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.errors", hasSize(4))) +===================================================================== +Found a 17 line (115 tokens) duplication in the following files: +Starting at line 188 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 74 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentVersionsResourceTest.java + + .perform(get("/api/concepts/" + conceptAttachmentMetadata.getConceptId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(1))); + + // update the metadata + ConceptAttachmentMetadata current = + conceptAttachmentService.findAllByConcept(conceptAttachmentMetadata.getConceptId()).get(0); + current.setLanguage("en"); + + mockMvc + .perform(put("/api/concepts/" + conceptAttachmentMetadata.getConceptId() + "/attachments/" + + attachment.getOriginalFilename()).content(TestUtil.convertObjectToJsonBytes(current)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isNoContent()); + + // read the updated attachment and check the version + mockMvc + .perform(get("/api/concepts/" + conceptAttachmentMetadata.getConceptId() + "/attachments")) +===================================================================== +Found a 18 line (115 tokens) duplication in the following files: +Starting at line 200 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 74 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentVersionsResourceTest.java + + .perform(get("/api/data-sets/" + dataSetAttachmentMetadata.getDataSetId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(1)));; + + // update the metadata + DataSetAttachmentMetadata current = + dataSetAttachmentService.findAllByDataSet(dataSetAttachmentMetadata.getDataSetId()).get(0); + current.setLanguage("en"); + + mockMvc + .perform(put("/api/data-sets/" + dataSetAttachmentMetadata.getDataSetId() + "/attachments/" + + attachment.getOriginalFilename()).content(TestUtil.convertObjectToJsonBytes(current)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isNoContent()); + + // read the updated attachment and check the version + mockMvc + .perform(get( + "/api/data-sets/" + dataSetAttachmentMetadata.getDataSetId() + "/attachments")) +===================================================================== +Found a 17 line (115 tokens) duplication in the following files: +Starting at line 182 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 73 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentVersionsResourceTest.java + + mockMvc.perform(get("/api/surveys/" + surveyAttachmentMetadata.getSurveyId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(1)));; + + // update the metadata + SurveyAttachmentMetadata current = + surveyAttachmentService.findAllBySurvey(surveyAttachmentMetadata.getSurveyId()).get(0); + current.setLanguage("en"); + + mockMvc + .perform(put("/api/surveys/" + surveyAttachmentMetadata.getSurveyId() + "/attachments/" + + attachment.getOriginalFilename()).content(TestUtil.convertObjectToJsonBytes(current)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isNoContent()); + + // read the updated attachment and check the version + mockMvc + .perform(get("/api/surveys/" + surveyAttachmentMetadata.getSurveyId() + "/attachments")) +===================================================================== +Found a 11 line (114 tokens) duplication in the following files: +Starting at line 105 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 140 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java + + mockMvc.perform(put(API_DATASETS_URI + "/" + dataSet.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataSet)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); + + // check that auditing attributes have been set + mockMvc.perform(get(API_DATASETS_URI + "/" + dataSet.getId())) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.createdDate", not(isEmptyOrNullString()))) + .andExpect(jsonPath("$.lastModifiedDate", not(isEmptyOrNullString()))) + .andExpect(jsonPath("$.createdBy", is("user"))) + .andExpect(jsonPath("$.lastModifiedBy", is("user"))); +===================================================================== +Found a 18 line (114 tokens) duplication in the following files: +Starting at line 204 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 223 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + .dataAcquisitionProjectId(project.getId()) + .title(I18nString.builder().de("titel") + .en("title") + .build()) + .fieldPeriod(Period.builder().start(LocalDate.now()) + .end(LocalDate.now() + .plusDays(1)) + .build()) + .build(); + + // create the survey with the given id but with an unknown project + mockMvc.perform(put(API_SURVEYS_URI + "/" + survey.getId()) + .content(TestUtil.convertObjectToJsonBytes(survey)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()); + } + + @Test + public void testCreateSurveyEmptyProject() throws Exception { +===================================================================== +Found a 19 line (114 tokens) duplication in the following files: +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java +Starting at line 26 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/domain/QQuestion.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractShadowableRdcDomainObject _super = new eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractShadowableRdcDomainObject(this); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("annotations")); + + public final ListPath conceptIds = this.createList("conceptIds", String.class, StringPath.class, PathInits.DIRECT2); + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + public final StringPath dataAcquisitionProjectId = createString("dataAcquisitionProjectId"); + + public final StringPath dataPackageId = createString("dataPackageId"); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString description = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("description")); +===================================================================== +Found a 6 line (114 tokens) duplication in the following files: +Starting at line 145 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 164 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 154 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java +Starting at line 176 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + public QInstrumentSearchDocument(Class type, PathMetadata metadata, PathInits inits) { + super(type, metadata, inits); + this.completeTitle = inits.isInitialized("completeTitle") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("completeTitle")) : null; + this.configuration = inits.isInitialized("configuration") ? new eu.dzhw.fdz.metadatamanagement.projectmanagement.domain.QConfiguration(forProperty("configuration")) : null; + this.dataPackage = inits.isInitialized("dataPackage") ? new QDataPackageSubDocument(forProperty("dataPackage"), inits.get("dataPackage")) : null; + this.guiLabels = inits.isInitialized("guiLabels") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("guiLabels")) : null; +===================================================================== +Found a 10 line (113 tokens) duplication in the following files: +Starting at line 88 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java +Starting at line 81 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java + + public final ListPath nestedInstruments = this.createList("nestedInstruments", InstrumentNestedDocument.class, QInstrumentNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedQuestions = this.createList("nestedQuestions", QuestionNestedDocument.class, QQuestionNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedSurveys = this.createList("nestedSurveys", SurveyNestedDocument.class, QSurveyNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedVariables = this.createList("nestedVariables", VariableNestedDocument.class, QVariableNestedDocument.class, PathInits.DIRECT2); + + //inherited + public final NumberPath number; +===================================================================== +Found a 17 line (111 tokens) duplication in the following files: +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSubDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSubDocument.java + + public static final QInstrumentSubDocument instrumentSubDocument = new QInstrumentSubDocument("instrumentSubDocument"); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractRdcDomainObject _super = new eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractRdcDomainObject(this); + + public final ListPath conceptIds = this.createList("conceptIds", String.class, StringPath.class, PathInits.DIRECT2); + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + public final StringPath dataAcquisitionProjectId = createString("dataAcquisitionProjectId"); + + public final StringPath dataPackageId = createString("dataPackageId"); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString description; +===================================================================== +Found a 10 line (108 tokens) duplication in the following files: +Starting at line 72 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 81 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java + + public final ListPath nestedInstruments = this.createList("nestedInstruments", InstrumentNestedDocument.class, QInstrumentNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedQuestions = this.createList("nestedQuestions", QuestionNestedDocument.class, QQuestionNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedSurveys = this.createList("nestedSurveys", SurveyNestedDocument.class, QSurveyNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedVariables = this.createList("nestedVariables", VariableNestedDocument.class, QVariableNestedDocument.class, PathInits.DIRECT2); + + //inherited + public final SetPath originalLanguages = _super.originalLanguages; +===================================================================== +Found a 14 line (107 tokens) duplication in the following files: +Starting at line 219 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java +Starting at line 219 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java +Starting at line 223 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java +Starting at line 221 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionImageShadowCopyServiceTest.java +Starting at line 216 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java + + gridFsMetadataUpdateService.store(is, filename, "text/plain", metadata); + is.close(); + } + + private void assertExpectedFilesExistence(List expectedFiles) { + Iterator it = gridFsOperations.find(new Query()).iterator(); + List fileNames = new ArrayList<>(); + while (it.hasNext()) { + fileNames.add(it.next().getFilename()); + } + assertThat(fileNames.size(), equalTo(expectedFiles.size())); + assertThat(fileNames, containsInAnyOrder(expectedFiles.toArray())); + } +} +===================================================================== +Found a 14 line (107 tokens) duplication in the following files: +Starting at line 217 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 198 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + "/api/data-sets/" + dataSetAttachmentMetadata.getDataSetId() + "/attachments")) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.[0].version", is(1))) + .andExpect(jsonPath("$.[0].createdBy", is("test"))) + .andExpect(jsonPath("$.[0].lastModifiedBy", is("test"))) + .andExpect(jsonPath("$.[0].language", is("en"))); + } + + @Test + @WithMockUser(authorities=AuthoritiesConstants.PUBLISHER) + public void testUploadAttachmentWithWrongLanguage() throws Exception { + + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); +===================================================================== +Found a 34 line (107 tokens) duplication in the following files: +Starting at line 55 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 54 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResponseRateImageResourceTest.java + + @Autowired + private ElasticsearchUpdateQueueItemRepository elasticsearchUpdateQueueItemRepository; + + @Autowired + private ElasticsearchAdminService elasticsearchAdminService; + + @Autowired + private JaversService javersService; + + @Autowired + private GridFsOperations gridFsOperations; + + @Autowired + private GridFsMetadataUpdateService gridFsMetadataUpdateService; + + private MockMvc mockMvc; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac) + .build(); + } + + @After + public void cleanUp() { + this.surveyRepository.deleteAll(); + this.elasticsearchUpdateQueueItemRepository.deleteAll(); + this.elasticsearchAdminService.recreateAllIndices(); + javersService.deleteAll(); + this.gridFsOperations.delete(new Query()); + } + + @Test + @WithMockUser(authorities=AuthoritiesConstants.PUBLISHER, username="test") +===================================================================== +Found a 16 line (106 tokens) duplication in the following files: +Starting at line 21 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QDataSet.java +Starting at line 20 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QSurvey.java + + public static final QDataPackage dataPackage = new QDataPackage("dataPackage"); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractShadowableRdcDomainObject _super = new eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractShadowableRdcDomainObject(this); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("annotations")); + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + public final StringPath dataAcquisitionProjectId = createString("dataAcquisitionProjectId"); + + public final ListPath dataCurators = this.createList("dataCurators", eu.dzhw.fdz.metadatamanagement.common.domain.Person.class, eu.dzhw.fdz.metadatamanagement.common.domain.QPerson.class, PathInits.DIRECT2); +===================================================================== +Found a 14 line (105 tokens) duplication in the following files: +Starting at line 290 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 316 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + public void testDeleteSurvey() throws Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + rdcProjectRepository.save(project); + + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); + + // create the survey with the given id + mockMvc.perform(put(API_SURVEYS_URI + "/" + survey.getId()) + .content(TestUtil.convertObjectToJsonBytes(survey)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); + + // delete the survey + mockMvc.perform(delete(API_SURVEYS_URI + "/" + survey.getId())) + .andExpect(status().is2xxSuccessful()); +===================================================================== +Found a 15 line (105 tokens) duplication in the following files: +Starting at line 69 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 75 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java + + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + //inherited + public final StringPath masterId = _super.masterId; + + public final ListPath nestedConcepts = this.createList("nestedConcepts", ConceptNestedDocument.class, QConceptNestedDocument.class, PathInits.DIRECT2); + + public final QDataPackageNestedDocument nestedDataPackage; + + public final ListPath nestedDataSets = this.createList("nestedDataSets", DataSetNestedDocument.class, QDataSetNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedQuestions = this.createList("nestedQuestions", QuestionNestedDocument.class, QQuestionNestedDocument.class, PathInits.DIRECT2); +===================================================================== +Found a 18 line (104 tokens) duplication in the following files: +Starting at line 85 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 72 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString introduction = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(_super.introduction); + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + //inherited + public final StringPath masterId = _super.masterId; + + public final ListPath nestedConcepts = this.createList("nestedConcepts", ConceptNestedDocument.class, QConceptNestedDocument.class, PathInits.DIRECT2); + + public final QDataPackageNestedDocument nestedDataPackage; + + public final ListPath nestedDataSets = this.createList("nestedDataSets", DataSetNestedDocument.class, QDataSetNestedDocument.class, PathInits.DIRECT2); + + public final QInstrumentNestedDocument nestedInstrument; +===================================================================== +Found a 14 line (103 tokens) duplication in the following files: +Starting at line 103 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 797 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + public void testCreateVariable() throws Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + List surveyNumbers = new ArrayList<>(); + surveyNumbers.add(1); + + Variable variable = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "var1", 1, surveyNumbers); + + // create the variable with the given id + mockMvc.perform(put(API_VARIABLES_URI + "/" + variable.getId()) + .content(TestUtil.convertObjectToJsonBytes(variable)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); +===================================================================== +Found a 7 line (103 tokens) duplication in the following files: +Starting at line 70 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 87 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java + + public final ListPath nestedDataSets = this.createList("nestedDataSets", DataSetNestedDocument.class, QDataSetNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedInstruments = this.createList("nestedInstruments", InstrumentNestedDocument.class, QInstrumentNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedQuestions = this.createList("nestedQuestions", QuestionNestedDocument.class, QQuestionNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedSurveys = this.createList("nestedSurveys", SurveyNestedDocument.class, QSurveyNestedDocument.class, PathInits.DIRECT2); +===================================================================== +Found a 7 line (103 tokens) duplication in the following files: +Starting at line 72 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 88 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java +Starting at line 119 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + public final ListPath nestedInstruments = this.createList("nestedInstruments", InstrumentNestedDocument.class, QInstrumentNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedQuestions = this.createList("nestedQuestions", QuestionNestedDocument.class, QQuestionNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedSurveys = this.createList("nestedSurveys", SurveyNestedDocument.class, QSurveyNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedVariables = this.createList("nestedVariables", VariableNestedDocument.class, QVariableNestedDocument.class, PathInits.DIRECT2); +===================================================================== +Found a 15 line (103 tokens) duplication in the following files: +Starting at line 69 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 88 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java + + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + //inherited + public final StringPath masterId = _super.masterId; + + public final ListPath nestedConcepts = this.createList("nestedConcepts", ConceptNestedDocument.class, QConceptNestedDocument.class, PathInits.DIRECT2); + + public final QDataPackageNestedDocument nestedDataPackage; + + public final ListPath nestedDataSets = this.createList("nestedDataSets", DataSetNestedDocument.class, QDataSetNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedQuestions = this.createList("nestedQuestions", QuestionNestedDocument.class, QQuestionNestedDocument.class, PathInits.DIRECT2); +===================================================================== +Found a 13 line (102 tokens) duplication in the following files: +Starting at line 193 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 252 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 314 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 367 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java + + surveyNumbers.add(1); + List listOfSurveyIds = new ArrayList<>(); + listOfSurveyIds.add(survey.getId()); + + //Variables + Variable variable1 = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "name1", 1, surveyNumbers); + this.variableRepository.save(variable1); + Variable variable2 = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "name2", 2, surveyNumbers); + this.variableRepository.save(variable2); + Variable variable3 = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "name3", 3, surveyNumbers); +===================================================================== +Found a 18 line (101 tokens) duplication in the following files: +Starting at line 93 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 248 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java + + public void testCreateDataSet() throws Exception { + + // Arrange + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + this.dataAcquisitionProjectRepository.save(project); + + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); + + DataSet dataSet = UnitTestCreateDomainObjectUtils.buildDataSet(project.getId(), survey.getId(), 1); + + // Act and Assert + // create the variable with the given id + mockMvc.perform(put(API_DATASETS_URI + "/" + dataSet.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataSet)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); + + // check that auditing attributes have been set + mockMvc.perform(get(API_DATASETS_URI + "/" + dataSet.getId())) +===================================================================== +Found a 13 line (100 tokens) duplication in the following files: +Starting at line 132 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageOverviewResource.java +Starting at line 129 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetReportResource.java + + @PathVariable("dataPackageId") String dataPackageId, + @RequestParam("onBehalfOf") String onBehalfOf, @PathVariable("language") String language) + throws IOException { + Optional user = userService.getUserWithAuthoritiesByLogin(onBehalfOf); + if (user.isPresent()) { + // TODO refactor this + User userInstance = user.get(); + // switch to on behalf user for correct modification names + Collection currentAuthorities = + SecurityContextHolder.getContext().getAuthentication().getAuthorities(); + UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken( + userInstance.getLogin(), userInstance.getPassword(), currentAuthorities); + SecurityContextHolder.getContext().setAuthentication(authentication); +===================================================================== +Found a 15 line (100 tokens) duplication in the following files: +Starting at line 93 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 277 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java + + public void testCreateDataSet() throws Exception { + + // Arrange + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + this.dataAcquisitionProjectRepository.save(project); + + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); + + DataSet dataSet = UnitTestCreateDomainObjectUtils.buildDataSet(project.getId(), survey.getId(), 1); + + // Act and Assert + // create the variable with the given id + mockMvc.perform(put(API_DATASETS_URI + "/" + dataSet.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataSet)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 16 line (99 tokens) duplication in the following files: +Starting at line 74 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 101 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 133 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 177 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 59 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentVersionsResourceTest.java + + public void testUploadValidAttachment() throws Exception { + + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); + InstrumentAttachmentMetadata instrumentAttachmentMetadata = + UnitTestCreateDomainObjectUtils.buildInstrumentAttachmentMetadata("projectid", 1); + MockMultipartFile metadata = new MockMultipartFile("instrumentAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(instrumentAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/instruments/attachments") + .file(attachment).file(metadata)).andExpect(status().isCreated()); + + // read the created attachment and check the version + mockMvc + .perform(get( + "/api/instruments/" + instrumentAttachmentMetadata.getInstrumentId() + "/attachments")) +===================================================================== +Found a 16 line (99 tokens) duplication in the following files: +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 116 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 143 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 170 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 59 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentVersionsResourceTest.java + + public void testUploadValidAttachment() throws Exception { + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); + SurveyAttachmentMetadata surveyAttachmentMetadata = UnitTestCreateDomainObjectUtils + .buildSurveyAttachmentMetadata("projectid", 1); + MockMultipartFile metadata = new MockMultipartFile("surveyAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(surveyAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/surveys/attachments") + .file(attachment) + .file(metadata)) + .andExpect(status().isCreated()); + + // read the created attachment and check the version + mockMvc.perform( + get("/api/surveys/" + surveyAttachmentMetadata.getSurveyId() + "/attachments")) +===================================================================== +Found a 13 line (99 tokens) duplication in the following files: +Starting at line 382 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java +Starting at line 414 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java + + "alicejr@example.com", true, u.getLangKey(), u.getAuthorities(), false); + + // Good user + restMvc.perform(post("/api/register").contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(u))).andExpect(status().isCreated()); + + // Duplicate login + restMvc + .perform(post("/api/register").contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(dup))) + .andExpect(status().is4xxClientError()); + + Optional userDup = userRepository.findOneByEmail("alicejr@example.com"); +===================================================================== +Found a 14 line (99 tokens) duplication in the following files: +Starting at line 72 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 72 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java + + public final ListPath instruments = this.createList("instruments", InstrumentSubDocument.class, QInstrumentSubDocument.class, PathInits.DIRECT2); + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + //inherited + public final StringPath masterId = _super.masterId; + + public final ListPath nestedConcepts = this.createList("nestedConcepts", ConceptNestedDocument.class, QConceptNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedDataSets = this.createList("nestedDataSets", DataSetNestedDocument.class, QDataSetNestedDocument.class, PathInits.DIRECT2); +===================================================================== +Found a 13 line (97 tokens) duplication in the following files: +Starting at line 248 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 277 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java + + public void testDeleteDataSet() throws JsonSyntaxException, IOException, Exception { + // Arrange + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + this.dataAcquisitionProjectRepository.save(project); + + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); + + DataSet dataSet = UnitTestCreateDomainObjectUtils.buildDataSet(project.getId(), survey.getId(), 1); + + // create the DataSet with the given id + mockMvc.perform(put(API_DATASETS_URI + "/" + dataSet.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataSet)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 11 line (96 tokens) duplication in the following files: +Starting at line 65 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QDataSet.java +Starting at line 64 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java + + public final ListPath subDataSets = this.createList("subDataSets", SubDataSet.class, QSubDataSet.class, PathInits.DIRECT2); + + //inherited + public final StringPath successorId = _super.successorId; + + public final ListPath surveyIds = this.createList("surveyIds", String.class, StringPath.class, PathInits.DIRECT2); + + public final ListPath> surveyNumbers = this.>createList("surveyNumbers", Integer.class, NumberPath.class, PathInits.DIRECT2); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString type = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("type")); +===================================================================== +Found a 13 line (95 tokens) duplication in the following files: +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 200 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 235 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java + + public void testCreateRelatedPublications() throws IOException, Exception { + // ARRANGE + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + DataPackage dataPackage = UnitTestCreateDomainObjectUtils.buildDataPackage(project.getId()); + dataPackageRepository.save(dataPackage); + RelatedPublication relatedPublication = + UnitTestCreateDomainObjectUtils.buildRelatedPublication(); + // ACT + // create the related publication with the given id + this.mockMvc.perform(put(API_RELATED_PUBLICATION_URI + "/" + relatedPublication.getId()) + .content(TestUtil.convertObjectToJsonBytes(relatedPublication)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); +===================================================================== +Found a 13 line (94 tokens) duplication in the following files: +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 75 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java + + public void testCreateDataPackage() throws IOException, Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + DataPackage dataPackage = UnitTestCreateDomainObjectUtils.buildDataPackage(project.getId()); + + // create the dataPackage with the given id + mockMvc.perform(put(API_DATAPACKAGE_URI + "/" + dataPackage.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataPackage)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); + + // read the dataPackage under the new url + mockMvc.perform(get(API_DATAPACKAGE_URI + "/" + dataPackage.getId())) +===================================================================== +Found a 35 line (94 tokens) duplication in the following files: +Starting at line 26 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectLastReleaseResourceTest.java +Starting at line 26 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectReleasesResourceTest.java + +public class DataAcquisitionProjectLastReleaseResourceTest extends AbstractTest { + private static final String API_DATA_ACQUISITION_PROJECTS_URI = "/api/data-acquisition-projects"; + + @Autowired + private WebApplicationContext wac; + + @Autowired + private DataAcquisitionProjectRepository dataAcquisitionProjectRepository; + + @Autowired + private ElasticsearchUpdateQueueItemRepository elasticsearchUpdateQueueItemRepository; + + @Autowired + private ElasticsearchAdminService elasticsearchAdminService; + + @Autowired + private JaversService javersService; + + private MockMvc mockMvc; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac).build(); + } + + @After + public void cleanUp() { + dataAcquisitionProjectRepository.deleteAll(); + elasticsearchUpdateQueueItemRepository.deleteAll(); + elasticsearchAdminService.recreateAllIndices(); + javersService.deleteAll(); + } + + @Test + public void testFindReleases() throws IOException, Exception { +===================================================================== +Found a 9 line (94 tokens) duplication in the following files: +Starting at line 64 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptNestedDocument.java +Starting at line 70 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageNestedDocument.java +Starting at line 76 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionNestedDocument.java +Starting at line 66 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationNestedDocument.java +Starting at line 74 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveyNestedDocument.java + + public QConceptNestedDocument(Class type, PathMetadata metadata, PathInits inits) { + super(type, metadata, inits); + this._super = new QAbstractNestedSubDocument(type, metadata, inits); + this.completeTitle = inits.isInitialized("completeTitle") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("completeTitle")) : null; + this.createdBy = _super.createdBy; + this.createdDate = _super.createdDate; + this.lastModifiedBy = _super.lastModifiedBy; + this.lastModifiedDate = _super.lastModifiedDate; + this.title = inits.isInitialized("title") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("title")) : null; +===================================================================== +Found a 19 line (94 tokens) duplication in the following files: +Starting at line 36 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 40 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 36 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + public final ListPath concepts = this.createList("concepts", ConceptSubDocument.class, QConceptSubDocument.class, PathInits.DIRECT2); + + public final eu.dzhw.fdz.metadatamanagement.projectmanagement.domain.QConfiguration configuration; + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + //inherited + public final StringPath dataAcquisitionProjectId = _super.dataAcquisitionProjectId; + + public final QDataPackageSubDocument dataPackage; + + //inherited + public final StringPath dataPackageId = _super.dataPackageId; + + public final ListPath dataSets = this.createList("dataSets", DataSetSubDocument.class, QDataSetSubDocument.class, PathInits.DIRECT2); +===================================================================== +Found a 36 line (92 tokens) duplication in the following files: +Starting at line 39 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 31 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/StudySeriesesResourceControllerTest.java + + @Autowired + private WebApplicationContext wac; + + @Autowired + private DataAcquisitionProjectRepository dataAcquisitionProjectRepository; + + @Autowired + private DataPackageRepository dataPackageRepository; + + @Autowired + private ElasticsearchUpdateQueueItemRepository elasticsearchUpdateQueueItemRepository; + + @Autowired + private ElasticsearchAdminService elasticsearchAdminService; + + @Autowired + private JaversService javersService; + + private MockMvc mockMvc; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac) + .build(); + } + + @After + public void cleanUp() { + dataAcquisitionProjectRepository.deleteAll(); + dataPackageRepository.deleteAll(); + elasticsearchUpdateQueueItemRepository.deleteAll(); + elasticsearchAdminService.recreateAllIndices(); + javersService.deleteAll(); + } + + @Test +===================================================================== +Found a 19 line (92 tokens) duplication in the following files: +Starting at line 20 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/domain/QDaraUpdateQueueItem.java +Starting at line 20 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/domain/QElasticsearchIndicesVersion.java + + public static final QDaraUpdateQueueItem daraUpdateQueueItem = new QDaraUpdateQueueItem("daraUpdateQueueItem"); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractRdcDomainObject _super = new eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractRdcDomainObject(this); + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + public final StringPath id = createString("id"); + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + public final StringPath projectId = createString("projectId"); +===================================================================== +Found a 16 line (91 tokens) duplication in the following files: +Starting at line 146 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 186 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 262 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java + + public void testUpdateInstrument() throws Exception { + // Arrange + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + this.dataAcquisitionProjectRepository.save(project); + + Instrument instrument = + UnitTestCreateDomainObjectUtils.buildInstrument(project.getId(), project.getId() + "-sy1"); + + // Act and Assert + // create the instrument with the given id + mockMvc.perform(put(API_INSTRUMENTS_URI + "/" + instrument.getId()) + .content(TestUtil.convertObjectToJsonBytes(instrument)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); + + // delete the survey + mockMvc.perform(delete(API_INSTRUMENTS_URI + "/" + instrument.getId())) +===================================================================== +Found a 16 line (91 tokens) duplication in the following files: +Starting at line 26 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSubDocument.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("annotations")); + + public final ListPath conceptIds = this.createList("conceptIds", String.class, StringPath.class, PathInits.DIRECT2); + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + public final StringPath dataAcquisitionProjectId = createString("dataAcquisitionProjectId"); + + public final StringPath dataPackageId = createString("dataPackageId"); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString description = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("description")); +===================================================================== +Found a 12 line (90 tokens) duplication in the following files: +Starting at line 93 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 137 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java + + public final eu.dzhw.fdz.metadatamanagement.conceptmanagement.domain.QTags tags = new eu.dzhw.fdz.metadatamanagement.conceptmanagement.domain.QTags(_super.tags); + + // custom + // inherited + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString title = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(_super.title); + + public final ListPath variables = this.createList("variables", VariableSubDocument.class, QVariableSubDocument.class, PathInits.DIRECT2); + + //inherited + public final NumberPath version = _super.version; + + public QConceptSearchDocument(String variable) { +===================================================================== +Found a 13 line (89 tokens) duplication in the following files: +Starting at line 136 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 166 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java + + public void testReleasedDataPackageIsPubliclyVisible() throws IOException, Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + DataPackage dataPackage = UnitTestCreateDomainObjectUtils.buildDataPackage(project.getId()); + + // create the dataPackage with the given id + mockMvc.perform(put(API_DATAPACKAGE_URI + "/" + dataPackage.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataPackage)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); + + // release the project + project.setRelease(UnitTestCreateDomainObjectUtils.buildRelease()); +===================================================================== +Found a 12 line (88 tokens) duplication in the following files: +Starting at line 147 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 195 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 254 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 316 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java + + this.instrumentRepository.save(instrument); + + //Variables + Variable variable1 = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "name1", 1, surveyNumbers); + this.variableRepository.save(variable1); + Variable variable2 = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "name2", 2, surveyNumbers); + this.variableRepository.save(variable2); + Variable variable3 = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "name3", 3, surveyNumbers); + this.variableRepository.save(variable3); +===================================================================== +Found a 10 line (87 tokens) duplication in the following files: +Starting at line 148 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 179 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java + + project.setRelease(UnitTestCreateDomainObjectUtils.buildRelease()); + mockMvc.perform(put("/api/data-acquisition-projects" + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isNoContent()); + shadowCopyQueueItemService.executeShadowCopyActions(); + + UnitTestUserManagementUtils.logout(); + // ensure that there are still no pinned data packages + mockMvc.perform(get(API_DATAPACKAGE_URI + "?pinned=true")).andExpect(status().isOk()) + .andExpect(jsonPath("$.content.length()", is(0))); +===================================================================== +Found a 14 line (87 tokens) duplication in the following files: +Starting at line 83 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 146 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 186 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 262 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java + + public void testCreateInstrument() throws Exception { + + // Arrange + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + this.dataAcquisitionProjectRepository.save(project); + + Instrument instrument = + UnitTestCreateDomainObjectUtils.buildInstrument(project.getId(), project.getId() + "-sy1"); + + // Act and Assert + // create the instrument with the given id + mockMvc.perform(put(API_INSTRUMENTS_URI + "/" + instrument.getId()) + .content(TestUtil.convertObjectToJsonBytes(instrument)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 12 line (86 tokens) duplication in the following files: +Starting at line 240 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java +Starting at line 268 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java + + log.debug("Sending 'assignee group changed mail'"); + } + + users.parallelStream().forEach(user -> { + Locale locale = Locale.forLanguageTag(user.getLangKey()); + Context context = new Context(locale); + context.setVariable("user", user); + context.setVariable("projectId", projectId); + context.setVariable("locale", locale); + context.setVariable("baseUrl", baseUrl); + context.setVariable("messageToGroup", StringUtils.trimWhitespace(message)); + String content = templateEngine.process("assigneeGroupChanged", context); +===================================================================== +Found a 5 line (86 tokens) duplication in the following files: +Starting at line 322 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 329 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java + + mockMvc.perform(get(API_DATAPACKAGE_URI + "/" + dataPackage.getMasterId())) + .andExpect(status().isOk()).andExpect(jsonPath("$.id", equalTo(dataPackage.getId()))) + .andExpect(jsonPath("$.masterId", equalTo(dataPackage.getMasterId()))) + .andExpect(jsonPath("$.release.version", equalTo("1.0.0"))) + .andExpect(jsonPath("$.completeTitle").exists()).andExpect(jsonPath("$.doi").exists()); +===================================================================== +Found a 7 line (86 tokens) duplication in the following files: +Starting at line 120 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 109 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationSearchDocument.java + + public QConceptSearchDocument(Class type, PathMetadata metadata, PathInits inits) { + super(type, metadata, inits); + this.completeTitle = inits.isInitialized("completeTitle") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("completeTitle")) : null; + this.guiLabels = inits.isInitialized("guiLabels") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("guiLabels")) : null; + } + +} +===================================================================== +Found a 5 line (86 tokens) duplication in the following files: +Starting at line 164 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 145 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 164 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 154 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java +Starting at line 176 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + public QDataPackageSearchDocument(Class type, PathMetadata metadata, PathInits inits) { + super(type, metadata, inits); + this.completeTitle = inits.isInitialized("completeTitle") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("completeTitle")) : null; + this.configuration = inits.isInitialized("configuration") ? new eu.dzhw.fdz.metadatamanagement.projectmanagement.domain.QConfiguration(forProperty("configuration")) : null; + this.guiLabels = inits.isInitialized("guiLabels") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("guiLabels")) : null; +===================================================================== +Found a 13 line (85 tokens) duplication in the following files: +Starting at line 90 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 119 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 152 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 185 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 59 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentVersionsResourceTest.java + + public void testUploadValidAttachment() throws Exception { + + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); + DataSetAttachmentMetadata dataSetAttachmentMetadata = UnitTestCreateDomainObjectUtils + .buildDataSetAttachmentMetadata("projectid", 1); + MockMultipartFile metadata = new MockMultipartFile("dataSetAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(dataSetAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/data-sets/attachments") + .file(attachment) + .file(metadata)) + .andExpect(status().isCreated()); +===================================================================== +Found a 13 line (85 tokens) duplication in the following files: +Starting at line 120 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java +Starting at line 120 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java +Starting at line 121 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionImageShadowCopyServiceTest.java + + DataSetAttachmentMetadata shadow = createShadow(master, "1.0.0"); + createTestFileForAttachment(shadow); + + shadowCopyService.createShadowCopies(dataAcquisitionProject.getId(), + dataAcquisitionProject.getRelease(), "1.0.0"); + + List files = new ArrayList<>(); + gridFsOperations.find(new Query()).forEach(files::add); + + assertThat(files.size(), equalTo(2)); + + Query shadowQuery = new Query(GridFsCriteria.whereFilename() + .is("/data-sets/dat-" + PROJECT_ID + "-ds1$-1.0.0/attachments/filename.txt")); +===================================================================== +Found a 14 line (85 tokens) duplication in the following files: +Starting at line 171 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 210 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 236 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java + + public void testUpdateQuestion() throws Exception { + // Arrange + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + this.dataAcquisitionProjectRepository.save(project); + + Question question = UnitTestCreateDomainObjectUtils + .buildQuestion(project.getId(), 123, "instrument-Id"); + // Act and Assert + // create the variable with the given id + mockMvc.perform(put(API_QUESTIONS_URI + "/" + question.getId()) + .content(TestUtil.convertObjectToJsonBytes(question)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); + + question.setQuestionText(I18nString.builder().de("Angepasst") +===================================================================== +Found a 8 line (84 tokens) duplication in the following files: +Starting at line 332 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java +Starting at line 411 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java + + String subject = messageSource.getMessage("email.dataset-report-error.title", + new Object[] {errorNotification.getDomainObjectId()}, locale); + List adminAddresses = admins.stream().map(User::getEmail).collect(Collectors.toList()); + sendEmail(sender, new String[] {onBehalfUser.getEmail()}, + adminAddresses.toArray(new String[adminAddresses.size()]), null, subject, content, false, + true); + + } +===================================================================== +Found a 25 line (84 tokens) duplication in the following files: +Starting at line 42 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageShadowCopyServiceTest.java +Starting at line 42 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentShadowCopyServiceTest.java +Starting at line 47 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionShadowCopyServiceTest.java +Starting at line 43 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/VariableShadowCopyServiceTest.java + + private DataPackageShadowCopyService shadowCopyService; + + @Autowired + private ElasticsearchUpdateQueueItemRepository elasticsearchUpdateQueueItemRepository; + + @Autowired + private ElasticsearchAdminService elasticsearchAdminService; + + private DataAcquisitionProject project; + + private Release release; + + @Before + public void setUp() { + release = new Release("1.0.0", LocalDateTime.now(), null, false); + DataAcquisitionProject releasedProject = + UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + releasedProject.setRelease(release); + project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + project.setRelease(release); + project.setId(PROJECT_ID); + } + + @After + public void tearDown() { +===================================================================== +Found a 10 line (84 tokens) duplication in the following files: +Starting at line 87 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageShadowCopyServiceTest.java +Starting at line 92 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetShadowCopyServiceTest.java +Starting at line 87 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentShadowCopyServiceTest.java +Starting at line 77 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/service/DataAcquisitionProjectShadowCopyServiceTest.java +Starting at line 93 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionShadowCopyServiceTest.java +Starting at line 88 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/VariableShadowCopyServiceTest.java + + DataPackage shadowCopy = shadowCopyOpt.get(); + + assertThat(shadowCopy.getId(), equalTo(master.getId() + "-" + release.getVersion())); + assertThat(shadowCopy.isShadow(), equalTo(true)); + assertThat(shadowCopy.getSuccessorId(), equalTo(null)); + assertThat(shadowCopy.getMasterId(), equalTo(master.getId())); + } + + @Test + public void createShadowCopyWithSameReleaseVersion() { +===================================================================== +Found a 12 line (84 tokens) duplication in the following files: +Starting at line 100 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionImageResourceTest.java +Starting at line 119 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionImageResourceTest.java + + new MockMultipartFile("image", "image.png", "image/png", "fakeimage".getBytes()); + QuestionImageMetadata questionImageMetadata = + UnitTestCreateDomainObjectUtils.buildQuestionImageMetadata("projectid", "questionid"); + questionImageMetadata.setQuestionId(questionImageMetadata.getQuestionId() + "-1.0.0"); + questionImageMetadata.generateId(); + MockMultipartFile metadata = new MockMultipartFile("questionImageMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(questionImageMetadata)); + + mockMvc + .perform(MockMvcRequestBuilders.multipart("/api/questions/images").file(attachment) + .file(metadata)) + .andExpect(status().isBadRequest()).andExpect(jsonPath("$.errors[0].message", +===================================================================== +Found a 9 line (83 tokens) duplication in the following files: +Starting at line 11 of /home/reitmann/data/metadatamanagement/node_modules/JSV/jsdoc-toolkit/java/src/JsDebugRun.java +Starting at line 11 of /home/reitmann/data/metadatamanagement/node_modules/JSV/jsdoc-toolkit/java/src/JsRun.java + +public class JsDebugRun { + public static void main(String[] args) { + String[] jsargs = {"-j="+args[0]}; + + String[] allArgs = new String[jsargs.length + args.length]; + System.arraycopy(args, 0, allArgs, 0, args.length); + System.arraycopy(jsargs, 0, allArgs, args.length ,jsargs.length); + + org.mozilla.javascript.tools.debugger.Main.main(allArgs); +===================================================================== +Found a 10 line (83 tokens) duplication in the following files: +Starting at line 204 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 217 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 198 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + .perform(get("/api/concepts/" + conceptAttachmentMetadata.getConceptId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.[0].version", is(1))) + .andExpect(jsonPath("$.[0].createdBy", is("test"))) + .andExpect(jsonPath("$.[0].lastModifiedBy", is("test"))) + .andExpect(jsonPath("$.[0].language", is("en"))); + } + + @Test + @WithMockUser(authorities=AuthoritiesConstants.PUBLISHER) + public void testUploadAttachmentWithWrongType() throws Exception { +===================================================================== +Found a 11 line (83 tokens) duplication in the following files: +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 119 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 152 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 185 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 59 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentVersionsResourceTest.java + + public void testUploadValidAttachment() throws Exception { + + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); + DataPackageAttachmentMetadata dataPackageAttachmentMetadata = + UnitTestCreateDomainObjectUtils.buildDataPackageAttachmentMetadata("projectid"); + MockMultipartFile metadata = new MockMultipartFile("dataPackageAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(dataPackageAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/data-packages/attachments") + .file(attachment).file(metadata)).andExpect(status().isCreated()); +===================================================================== +Found a 13 line (83 tokens) duplication in the following files: +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 217 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 75 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java + + public void testCreateDataPackage() throws IOException, Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + DataPackage dataPackage = UnitTestCreateDomainObjectUtils.buildDataPackage(project.getId()); + + // create the dataPackage with the given id + mockMvc.perform(put(API_DATAPACKAGE_URI + "/" + dataPackage.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataPackage)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); + + // read the dataPackage under the new url + mockMvc.perform(get(API_DATAPACKAGE_URI + "/" + dataPackage.getId())) +===================================================================== +Found a 13 line (83 tokens) duplication in the following files: +Starting at line 88 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 171 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 210 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 236 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 312 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java + + public void testCreateQuestion() throws Exception { + + // Arrange + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + this.dataAcquisitionProjectRepository.save(project); + + Question question = UnitTestCreateDomainObjectUtils + .buildQuestion(project.getId(), 123, "instrument-Id"); + // Act and Assert + // create the Question with the given id + mockMvc.perform(put(API_QUESTIONS_URI + "/" + question.getId()) + .content(TestUtil.convertObjectToJsonBytes(question)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 17 line (83 tokens) duplication in the following files: +Starting at line 99 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 125 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java + + this.mockMvc.perform(put(API_RELATED_PUBLICATION_URI + "/" + relatedPublication.getId()) + .content(TestUtil.convertObjectToJsonBytes(relatedPublication)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); + + // ASSERT + // read the related publication under the new url + this.mockMvc.perform(get(API_RELATED_PUBLICATION_URI + "/" + relatedPublication.getId())) + .andExpect(status().isOk()); + + elasticsearchUpdateQueueService.processAllQueueItems(); + + // check that there is one dataPackage and one publication document + assertThat(elasticsearchAdminService.countAllDocuments(), equalTo(2L)); + } + + @Test + public void testCreateRelatedPublicationsWithPost() throws IOException, Exception { +===================================================================== +Found a 11 line (83 tokens) duplication in the following files: +Starting at line 65 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QDataSet.java +Starting at line 64 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java +Starting at line 92 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/QVariable.java + + public final ListPath subDataSets = this.createList("subDataSets", SubDataSet.class, QSubDataSet.class, PathInits.DIRECT2); + + //inherited + public final StringPath successorId = _super.successorId; + + public final ListPath surveyIds = this.createList("surveyIds", String.class, StringPath.class, PathInits.DIRECT2); + + public final ListPath> surveyNumbers = this.>createList("surveyNumbers", Integer.class, NumberPath.class, PathInits.DIRECT2); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString type = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("type")); +===================================================================== +Found a 17 line (83 tokens) duplication in the following files: +Starting at line 42 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetNestedDocument.java +Starting at line 42 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentNestedDocument.java +Starting at line 44 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableNestedDocument.java + + public final StringPath lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate; + + public final StringPath masterId = createString("masterId"); + + public final BooleanPath shadow = createBoolean("shadow"); + + public final StringPath successorId = createString("successorId"); + + public final ListPath surveyIds = this.createList("surveyIds", String.class, StringPath.class, PathInits.DIRECT2); + + //inherited + public final NumberPath version; + + public QDataSetNestedDocument(String variable) { +===================================================================== +Found a 12 line (82 tokens) duplication in the following files: +Starting at line 41 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/helper/DataSetShadowCopyDataSource.java +Starting at line 42 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/helper/InstrumentShadowCopyDataSource.java + + DataSet copy = crudHelper.read(derivedId).orElseGet(DataSet::new); + BeanUtils.copyProperties(source, copy, "version"); + copy.setId(derivedId); + copy.setDataAcquisitionProjectId( + source.getDataAcquisitionProjectId() + "-" + release.getVersion()); + copy.setDataPackageId(source.getDataPackageId() + "-" + release.getVersion()); + copy.setSurveyIds(createDerivedSurveyIds(source.getSurveyIds(), release.getVersion())); + return copy; + } + + @Override + public Optional findPredecessorOfShadowCopy(DataSet shadowCopy, String previousVersion) { +===================================================================== +Found a 13 line (82 tokens) duplication in the following files: +Starting at line 120 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java +Starting at line 117 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java + + DataPackageAttachmentMetadata shadow = createShadow(master, "1.0.0"); + createTestFileForAttachment(shadow); + + shadowCopyService.createShadowCopies(dataAcquisitionProject.getId(), + dataAcquisitionProject.getRelease(), "1.0.0"); + + List files = new ArrayList<>(); + gridFsOperations.find(new Query()).iterator().forEachRemaining(files::add); + + assertThat(files.size(), equalTo(2)); + + Query shadowQuery = new Query(GridFsCriteria.whereFilename() + .is("/data-packages/stu-" + PROJECT_ID + "$-1.0.0/attachments/filename.txt")); +===================================================================== +Found a 11 line (82 tokens) duplication in the following files: +Starting at line 79 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java +Starting at line 79 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java +Starting at line 75 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java + + UnitTestCreateDomainObjectUtils.buildDataSetAttachmentMetadata(PROJECT_ID, 1); + master.generateId(); + master.setMasterId(master.getId()); + createTestFileForAttachment(master); + + shadowCopyService.createShadowCopies(dataAcquisitionProject.getId(), + dataAcquisitionProject.getRelease(), null); + + GridFSFile gridFsFile = gridFsOperations.findOne( + new Query(GridFsCriteria.whereMetaData("dataAcquisitionProjectId").is(PROJECT_ID + "-1.0.0") + .andOperator(GridFsCriteria.whereMetaData("shadow").is(true)))); +===================================================================== +Found a 11 line (82 tokens) duplication in the following files: +Starting at line 60 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectLastReleaseResourceTest.java +Starting at line 60 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectReleasesResourceTest.java + + public void testFindReleases() throws IOException, Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + project = dataAcquisitionProjectRepository.save(project); + + // assert that there are no releases yet + mockMvc.perform(get(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId() + "/releases")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(0))); + + // fake a release + project.setRelease(UnitTestCreateDomainObjectUtils.buildRelease()); + dataAcquisitionProjectRepository.save(project); +===================================================================== +Found a 12 line (82 tokens) duplication in the following files: +Starting at line 93 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 137 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 127 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java + + public final eu.dzhw.fdz.metadatamanagement.conceptmanagement.domain.QTags tags = new eu.dzhw.fdz.metadatamanagement.conceptmanagement.domain.QTags(_super.tags); + + // custom + // inherited + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString title = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(_super.title); + + public final ListPath variables = this.createList("variables", VariableSubDocument.class, QVariableSubDocument.class, PathInits.DIRECT2); + + //inherited + public final NumberPath version = _super.version; + + public QConceptSearchDocument(String variable) { +===================================================================== +Found a 15 line (82 tokens) duplication in the following files: +Starting at line 35 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 36 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 40 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java + + public final ListPath concepts = this.createList("concepts", ConceptSubDocument.class, QConceptSubDocument.class, PathInits.DIRECT2); + + public final eu.dzhw.fdz.metadatamanagement.projectmanagement.domain.QConfiguration configuration; + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + //inherited + public final StringPath dataAcquisitionProjectId = _super.dataAcquisitionProjectId; + + //inherited + public final ListPath dataCurators = _super.dataCurators; +===================================================================== +Found a 12 line (81 tokens) duplication in the following files: +Starting at line 76 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/helper/DataSetShadowCopyDataSource.java +Starting at line 78 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/helper/InstrumentShadowCopyDataSource.java + + .filter(shadowCopy -> !dataSetRepository.existsById(shadowCopy.getMasterId())); + } + + private static List createDerivedSurveyIds(List surveyIds, String version) { + return surveyIds.stream().map(surveyId -> surveyId + "-" + version) + .collect(Collectors.toList()); + } + + @Override + public void deleteExistingShadowCopies(String projectId, String version) { + String oldProjectId = projectId + "-" + version; + try (Stream dataSets = dataSetRepository +===================================================================== +Found a 7 line (81 tokens) duplication in the following files: +Starting at line 40 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/DataSetSearchDocument.java +Starting at line 43 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/SurveySearchDocument.java + + private List variables = new ArrayList<>(); + private List nestedVariables = new ArrayList<>(); + private List instruments = new ArrayList<>(); + private List nestedInstruments = new ArrayList<>(); + private List questions = new ArrayList<>(); + private List nestedQuestions = new ArrayList<>(); + private List surveys = new ArrayList<>(); +===================================================================== +Found a 13 line (81 tokens) duplication in the following files: +Starting at line 86 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 290 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 316 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + public void testCreateValidSurvey() throws Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + rdcProjectRepository.save(project); + + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); + + // create the survey with the given id + mockMvc.perform(put(API_SURVEYS_URI + "/" + survey.getId()) + .content(TestUtil.convertObjectToJsonBytes(survey)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); + + // read the survey under the new url + mockMvc.perform(get(API_SURVEYS_URI + "/" + survey.getId())) +===================================================================== +Found a 14 line (81 tokens) duplication in the following files: +Starting at line 227 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java +Starting at line 253 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java + + public void testFinishPasswordReset() throws Exception { + + // Arrange + User user = UnitTestUserManagementUtils.getDefaultUser(); + user.setPassword("sdkgfsdkkgfsdglkfglsdjkagfjklsdgfhklsdglkfglksdgslkfgsdklj12"); + user.setActivationKey("testActivateTrue"); + user.setActivated(true); + user.setResetKey("ActivationKey"); + user.setResetDate(LocalDateTime.now().minusHours(1L)); + this.userRepository.save(user); + + KeyAndPasswordDto dto = new KeyAndPasswordDto(); + dto.setKey(user.getResetKey()); + dto.setNewPassword("newPassword"); +===================================================================== +Found a 17 line (81 tokens) duplication in the following files: +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QDataSet.java +Starting at line 22 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QSurvey.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/QVariable.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractShadowableRdcDomainObject _super = new eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractShadowableRdcDomainObject(this); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("annotations")); + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + public final StringPath dataAcquisitionProjectId = createString("dataAcquisitionProjectId"); + + public final StringPath dataPackageId = createString("dataPackageId"); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString description = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("description")); +===================================================================== +Found a 16 line (81 tokens) duplication in the following files: +Starting at line 28 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QDataSet.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("annotations")); + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + public final StringPath dataAcquisitionProjectId = createString("dataAcquisitionProjectId"); + + public final StringPath dataPackageId = createString("dataPackageId"); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString description = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("description")); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString format; +===================================================================== +Found a 10 line (81 tokens) duplication in the following files: +Starting at line 41 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 51 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java + + public final ListPath dataPackages = this.createList("dataPackages", DataPackageSubDocument.class, QDataPackageSubDocument.class, PathInits.DIRECT2); + + public final ListPath dataSets = this.createList("dataSets", DataSetSubDocument.class, QDataSetSubDocument.class, PathInits.DIRECT2); + + // custom + // inherited + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString description = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(_super.description); + + //inherited + public final StringPath doi = _super.doi; +===================================================================== +Found a 20 line (80 tokens) duplication in the following files: +Starting at line 93 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentService.java +Starting at line 154 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentService.java + + + Pattern.quote(DataPackageAttachmentFilenameBuilder.buildFileNamePrefix(dataPackageId)))); + Iterable files = this.operations.find(query); + files.forEach(file -> { + DataPackageAttachmentMetadata metadata = mongoTemplate.getConverter() + .read(DataPackageAttachmentMetadata.class, file.getMetadata()); + if (metadata.isShadow()) { + throw new ShadowCopyDeleteNotAllowedException(); + } + javers.commitShallowDelete(currentUser, metadata); + }); + this.operations.delete(query); + } + + /** + * Load all metadata objects from gridfs (ordered by indexInDataPackage). + * + * @param dataPackageId The id of the dataPackage. + * @return A list of metadata. + */ + public List findAllByDataPackage(String dataPackageId) { +===================================================================== +Found a 20 line (80 tokens) duplication in the following files: +Starting at line 96 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentService.java +Starting at line 165 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentService.java + + "^" + Pattern.quote(DataSetAttachmentFilenameBuilder.buildFileNamePrefix(dataSetId)))); + Iterable files = this.operations.find(query); + files.forEach(file -> { + DataSetAttachmentMetadata metadata = + mongoTemplate.getConverter().read(DataSetAttachmentMetadata.class, file.getMetadata()); + if (metadata.isShadow()) { + throw new ShadowCopyDeleteNotAllowedException(); + } + javers.commitShallowDelete(currentUser, metadata); + }); + this.operations.delete(query); + } + + /** + * Load all metadata objects from gridfs (ordered by indexInDataSet). + * + * @param dataSetId The id of the dataSet. + * @return A list of metadata. + */ + public List findAllByDataSet(String dataSetId) { +===================================================================== +Found a 20 line (80 tokens) duplication in the following files: +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentService.java +Starting at line 158 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentService.java + + + Pattern.quote(InstrumentAttachmentFilenameBuilder.buildFileNamePrefix(instrumentId)))); + Iterable files = this.operations.find(query); + files.forEach(file -> { + InstrumentAttachmentMetadata metadata = + mongoTemplate.getConverter().read(InstrumentAttachmentMetadata.class, file.getMetadata()); + if (metadata.isShadow()) { + throw new ShadowCopyDeleteNotAllowedException(); + } + javers.commitShallowDelete(currentUser, metadata); + }); + this.operations.delete(query); + } + + /** + * Load all metadata objects from gridfs (ordered by indexInInstrument). + * + * @param instrumentId The id of the instrument. + * @return A list of metadata. + */ + public List findAllByInstrument(String instrumentId) { +===================================================================== +Found a 11 line (80 tokens) duplication in the following files: +Starting at line 147 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 369 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java + + this.instrumentRepository.save(instrument); + + //Variables + Variable variable1 = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "name1", 1, surveyNumbers); + this.variableRepository.save(variable1); + Variable variable2 = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "name2", 2, surveyNumbers); + this.variableRepository.save(variable2); + Variable variable3 = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "name3", 3, surveyNumbers); +===================================================================== +Found a 13 line (80 tokens) duplication in the following files: +Starting at line 48 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QDataSet.java +Starting at line 43 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSubDocument.java + + public final StringPath id = createString("id"); + + public final ListPath languages = this.createList("languages", String.class, StringPath.class, PathInits.DIRECT2); + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + public final StringPath masterId = createString("masterId"); + + public final NumberPath number = createNumber("number", Integer.class); +===================================================================== +Found a 7 line (80 tokens) duplication in the following files: +Starting at line 64 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptNestedDocument.java +Starting at line 70 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageNestedDocument.java +Starting at line 74 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetNestedDocument.java +Starting at line 74 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentNestedDocument.java +Starting at line 76 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionNestedDocument.java +Starting at line 66 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationNestedDocument.java +Starting at line 74 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveyNestedDocument.java +Starting at line 76 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableNestedDocument.java + + public QConceptNestedDocument(Class type, PathMetadata metadata, PathInits inits) { + super(type, metadata, inits); + this._super = new QAbstractNestedSubDocument(type, metadata, inits); + this.completeTitle = inits.isInitialized("completeTitle") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("completeTitle")) : null; + this.createdBy = _super.createdBy; + this.createdDate = _super.createdDate; + this.lastModifiedBy = _super.lastModifiedBy; +===================================================================== +Found a 11 line (79 tokens) duplication in the following files: +Starting at line 284 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 378 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java + + List dataPackageSubDocuments = + dataPackages.stream().map(dataPackage -> { + DataAcquisitionProject project = + projectRepository.findById(dataPackage.getDataAcquisitionProjectId()).orElse(null); + if (project == null) { + // project has been deleted, skip upsert + return null; + } + return new DataPackageSubDocument(dataPackage, + doiBuilder.buildDataPackageDoi(dataPackage, getRelease(project))); + }).filter(document -> document != null).collect(Collectors.toList()); +===================================================================== +Found a 17 line (79 tokens) duplication in the following files: +Starting at line 45 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentVersionsResourceTest.java +Starting at line 45 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentVersionsResourceTest.java +Starting at line 45 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentVersionsResourceTest.java +Starting at line 45 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentVersionsResourceTest.java +Starting at line 45 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentVersionsResourceTest.java + + private MockMvc mockMvc; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac).build(); + } + + @After + public void cleanUp() { + javersService.deleteAll(); + this.gridFsOperations.delete(new Query()); + } + + @Test + public void testUploadValidAttachmentAndCheckVersion() throws Exception { + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); +===================================================================== +Found a 15 line (79 tokens) duplication in the following files: +Starting at line 70 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAccessWaysResourceControllerTest.java +Starting at line 58 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/StudySeriesesResourceControllerTest.java + + surveyRepository.deleteAll(); + dataPackageRepository.deleteAll(); + elasticsearchUpdateQueueItemRepository.deleteAll(); + elasticsearchAdminService.recreateAllIndices(); + javersService.deleteAll(); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER) + public void testGetAccessWaysOfDataPackage() throws IOException, Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + DataPackage dataPackage = UnitTestCreateDomainObjectUtils.buildDataPackage(project.getId()); + dataPackageRepository.save(dataPackage); +===================================================================== +Found a 10 line (79 tokens) duplication in the following files: +Starting at line 114 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 136 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 166 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 186 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 217 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 75 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java + + public void testUnreleasedNotPubliclyVisible() throws IOException, Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + DataPackage dataPackage = UnitTestCreateDomainObjectUtils.buildDataPackage(project.getId()); + + // create the dataPackage with the given id + mockMvc.perform(put(API_DATAPACKAGE_URI + "/" + dataPackage.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataPackage)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); +===================================================================== +Found a 21 line (79 tokens) duplication in the following files: +Starting at line 52 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java +Starting at line 53 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionImageShadowCopyServiceTest.java + + private InstrumentAttachmentShadowCopyService shadowCopyService; + + @Autowired + private GridFsMetadataUpdateService gridFsMetadataUpdateService; + + private DataAcquisitionProject dataAcquisitionProject; + + private Release release; + + @Before + public void setup() { + release = new Release("1.0.0", LocalDateTime.now(), null, false); + + dataAcquisitionProject = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProject.setId(PROJECT_ID); + dataAcquisitionProject.setRelease(release); + } + + @After + public void teardown() { + Query query = new Query(GridFsCriteria.whereFilename().regex("^/instruments")); +===================================================================== +Found a 11 line (79 tokens) duplication in the following files: +Starting at line 158 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 168 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + + project.setRelease(UnitTestCreateDomainObjectUtils.buildRelease()); + this.mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isNoContent()); + + // Assert that the last version is 1.0.0 + lastRelease = this.versionsService.findLastRelease(project.getId()); + assertThat(lastRelease.getVersion(), is("1.0.0")); + + // Save third time without release (simulates unrelease) + project.setRelease(null); +===================================================================== +Found a 13 line (79 tokens) duplication in the following files: +Starting at line 397 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 429 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + public void testCreateVariableWithNonUniqueValueClass() throws Exception { + + // Arrange + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + List surveyNumbers = new ArrayList<>(); + surveyNumbers.add(1); + + Variable variable = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "var1", 1, surveyNumbers); + ValidResponse validResponse = variable.getDistribution().getValidResponses().get(0); + validResponse.setValue("123.456"); +===================================================================== +Found a 7 line (79 tokens) duplication in the following files: +Starting at line 95 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 90 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java +Starting at line 83 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java + + public final ListPath nestedSponsors = this.createList("nestedSponsors", eu.dzhw.fdz.metadatamanagement.common.domain.I18nString.class, eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString.class, PathInits.DIRECT2); + + public final ListPath nestedSurveys = this.createList("nestedSurveys", SurveyNestedDocument.class, QSurveyNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedVariables = this.createList("nestedVariables", VariableNestedDocument.class, QVariableNestedDocument.class, PathInits.DIRECT2); + + public final NumberPath numberOfWaves = createNumber("numberOfWaves", Integer.class); +===================================================================== +Found a 13 line (78 tokens) duplication in the following files: +Starting at line 70 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 80 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 81 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java + + this.conceptRepository.deleteAll(); + this.elasticsearchUpdateQueueItemRepository.deleteAll(); + this.elasticsearchAdminService.recreateAllIndices(); + this.javersService.deleteAll(); + this.gridFsOperations.delete(new Query()); + } + + @Test + @WithMockUser(authorities=AuthoritiesConstants.PUBLISHER, username="test") + public void testUploadValidAttachment() throws Exception { + + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); +===================================================================== +Found a 11 line (78 tokens) duplication in the following files: +Starting at line 79 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java +Starting at line 79 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java +Starting at line 79 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java +Starting at line 80 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionImageShadowCopyServiceTest.java +Starting at line 75 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java + + UnitTestCreateDomainObjectUtils.buildDataPackageAttachmentMetadata(PROJECT_ID); + master.generateId(); + master.setMasterId(master.getId()); + createTestFileForAttachment(master); + + shadowCopyService.createShadowCopies(dataAcquisitionProject.getId(), + dataAcquisitionProject.getRelease(), null); + + GridFSFile gridFsFile = gridFsOperations.findOne( + new Query(GridFsCriteria.whereMetaData("dataAcquisitionProjectId").is(PROJECT_ID + "-1.0.0") + .andOperator(GridFsCriteria.whereMetaData("shadow").is(true)))); +===================================================================== +Found a 9 line (78 tokens) duplication in the following files: +Starting at line 139 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 155 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + mockMvc.perform(get(API_QUESTIONS_URI + "/" + question.getId())).andExpect(status().isOk()) + .andExpect(jsonPath("$.createdDate", not(isEmptyOrNullString()))) + .andExpect(jsonPath("$.lastModifiedDate", not(isEmptyOrNullString()))) + .andExpect(jsonPath("$.createdBy", is("user"))) + .andExpect(jsonPath("$.lastModifiedBy", is("user"))); + } + + @Test + public void testDeleteQuestion() throws Exception { +===================================================================== +Found a 15 line (78 tokens) duplication in the following files: +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySubDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSubDocument.java + + public static final QSurveySubDocument surveySubDocument = new QSurveySubDocument("surveySubDocument"); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractRdcDomainObject _super = new eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractRdcDomainObject(this); + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + public final StringPath dataAcquisitionProjectId = createString("dataAcquisitionProjectId"); + + public final StringPath dataPackageId = createString("dataPackageId"); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString dataType; +===================================================================== +Found a 16 line (77 tokens) duplication in the following files: +Starting at line 26 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSubDocument.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("annotations")); + + public final ListPath conceptIds = this.createList("conceptIds", String.class, StringPath.class, PathInits.DIRECT2); + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + public final StringPath dataAcquisitionProjectId = createString("dataAcquisitionProjectId"); + + public final StringPath dataPackageId = createString("dataPackageId"); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString description = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("description")); +===================================================================== +Found a 16 line (77 tokens) duplication in the following files: +Starting at line 29 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/domain/QQuestion.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSubDocument.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("annotations")); + + public final ListPath conceptIds = this.createList("conceptIds", String.class, StringPath.class, PathInits.DIRECT2); + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + public final StringPath dataAcquisitionProjectId = createString("dataAcquisitionProjectId"); + + public final StringPath dataPackageId = createString("dataPackageId"); + + //inherited + public final BooleanPath hidden = _super.hidden; +===================================================================== +Found a 7 line (77 tokens) duplication in the following files: +Starting at line 70 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 87 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 87 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java + + public final ListPath nestedDataSets = this.createList("nestedDataSets", DataSetNestedDocument.class, QDataSetNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedInstruments = this.createList("nestedInstruments", InstrumentNestedDocument.class, QInstrumentNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedQuestions = this.createList("nestedQuestions", QuestionNestedDocument.class, QQuestionNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedSurveys = this.createList("nestedSurveys", SurveyNestedDocument.class, QSurveyNestedDocument.class, PathInits.DIRECT2); +===================================================================== +Found a 7 line (77 tokens) duplication in the following files: +Starting at line 81 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 119 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + public final ListPath nestedDataSets = this.createList("nestedDataSets", DataSetNestedDocument.class, QDataSetNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedQuestions = this.createList("nestedQuestions", QuestionNestedDocument.class, QQuestionNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedSurveys = this.createList("nestedSurveys", SurveyNestedDocument.class, QSurveyNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedVariables = this.createList("nestedVariables", VariableNestedDocument.class, QVariableNestedDocument.class, PathInits.DIRECT2); +===================================================================== +Found a 6 line (76 tokens) duplication in the following files: +Starting at line 115 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java +Starting at line 137 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java + + .andExpect(jsonPath("$[0].version", is(equalTo(2)))) + .andExpect(jsonPath("$[0].authors.length()", is(equalTo(concept.getAuthors().size())))) + .andExpect( + jsonPath("$[0].authors[0].firstName", is(concept.getAuthors().get(0).getFirstName()))) + .andExpect(jsonPath("$[1].id", is(concept.getId()))) + .andExpect(jsonPath("$[1].title.de", is("hurzDe2"))) +===================================================================== +Found a 7 line (76 tokens) duplication in the following files: +Starting at line 131 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 157 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java + + .andExpect(jsonPath("$[0].version", is(equalTo(2)))) + .andExpect(jsonPath("$[0].projectContributors.length()", + is(equalTo(dataPackage.getProjectContributors().size())))) + .andExpect(jsonPath("$[0].projectContributors[0].firstName", + is(dataPackage.getProjectContributors().get(0).getFirstName()))) + .andExpect(jsonPath("$[1].id", is(dataPackage.getId()))) + .andExpect(jsonPath("$[1].title.de", is("hurzDe2"))) +===================================================================== +Found a 10 line (76 tokens) duplication in the following files: +Starting at line 152 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java +Starting at line 152 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java +Starting at line 155 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java +Starting at line 153 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionImageShadowCopyServiceTest.java +Starting at line 149 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java + + DataPackageAttachmentMetadata shadow = createShadow(master, "1.0.0"); + createTestFileForAttachment(shadow); + release.setVersion("1.0.1"); + + shadowCopyService.createShadowCopies(dataAcquisitionProject.getId(), + dataAcquisitionProject.getRelease(), "1.0.0"); + + GridFSFile gridFsFile = gridFsOperations.findOne( + new Query(GridFsCriteria.whereMetaData("dataAcquisitionProjectId").is(PROJECT_ID + "-1.0.0") + .andOperator(GridFsCriteria.whereMetaData("shadow").is(true)))); +===================================================================== +Found a 13 line (76 tokens) duplication in the following files: +Starting at line 122 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 353 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java + + private DataAcquisitionProject buildValidProject() { + //Arrange + //Project + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + project.getConfiguration().setDataPackagesState(new ProjectState(true, true)); + this.rdcProjectRepository.save(project); + + //Survey + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); + this.surveyRepository.save(survey); + List surveyNumbers = new ArrayList<>(); + surveyNumbers.add(1); + List listOfSurveyIds = new ArrayList<>(); +===================================================================== +Found a 9 line (76 tokens) duplication in the following files: +Starting at line 86 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 154 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java + + public void testCreateDataAcquisitionProject() throws IOException, Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + // create the project with the given id + mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isCreated()); + + // read the project under the new url + mockMvc.perform(get(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId())) +===================================================================== +Found a 10 line (75 tokens) duplication in the following files: +Starting at line 86 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 68 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java + + public void testCreateConcept() throws IOException, Exception { + Concept concept = UnitTestCreateDomainObjectUtils.buildConcept(); + + // create the concept with the given id + mockMvc.perform(put(API_CONCEPT_URI + "/" + concept.getId()) + .content(TestUtil.convertObjectToJsonBytes(concept)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); + + // read the concept under the new url + mockMvc.perform(get(API_CONCEPT_URI + "/" + concept.getId())).andExpect(status().isOk()); +===================================================================== +Found a 12 line (75 tokens) duplication in the following files: +Starting at line 120 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 147 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java + + public void testCreateQuestionWithPost() throws Exception { + + // Arrange + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + this.dataAcquisitionProjectRepository.save(project); + + Question question = + UnitTestCreateDomainObjectUtils.buildQuestion(project.getId(), 123, "instrument-Id"); + // Act and Assert + // create the Question with the given id + mockMvc.perform(post(API_QUESTIONS_URI).content(TestUtil.convertObjectToJsonBytes(question)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); +===================================================================== +Found a 8 line (75 tokens) duplication in the following files: +Starting at line 74 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 95 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java + + public final ListPath nestedQuestions = this.createList("nestedQuestions", QuestionNestedDocument.class, QQuestionNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedSurveys = this.createList("nestedSurveys", SurveyNestedDocument.class, QSurveyNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedVariables = this.createList("nestedVariables", VariableNestedDocument.class, QVariableNestedDocument.class, PathInits.DIRECT2); + + //inherited + public final SetPath originalLanguages = _super.originalLanguages; +===================================================================== +Found a 8 line (74 tokens) duplication in the following files: +Starting at line 57 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/repository/DaraUpdateQueueItemRepositoryImpl.java +Starting at line 45 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/repository/ElasticsearchUpdateQueueItemRepositoryImpl.java + + public List findOldestLockedItems(String updateStartedBy, + LocalDateTime updateStartedAt) { + Query query = new Query(new Criteria().andOperator(Criteria.where("updateStartedBy") + .is(updateStartedBy), + Criteria.where("updateStartedAt") + .is(updateStartedAt))).limit(BULK_SIZE) + .with(Sort.by(Direction.ASC, "createdDate")); + return mongoOperations.find(query, DaraUpdateQueueItem.class); +===================================================================== +Found a 10 line (74 tokens) duplication in the following files: +Starting at line 375 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/unittesthelper/util/UnitTestCreateDomainObjectUtils.java +Starting at line 390 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/unittesthelper/util/UnitTestCreateDomainObjectUtils.java + + public static RelatedPublication buildRelatedPublication() { + + List dataPackageIds = new ArrayList<>(); + dataPackageIds.add(UnitTestCreateValidIds.buildDataPackageId("testproject")); + + return RelatedPublication.builder().doi("A DOI") + .id(UnitTestCreateValidIds.buildRelatedPublicationId("HurzId123")) + .publicationAbstract("A publication Abstract").sourceLink("http://www.hurzexample.de/") + .sourceReference("A Source Reference").title("A Title of a Related Publication") + .dataPackageIds(dataPackageIds).authors("Author").year(2017) +===================================================================== +Found a 18 line (74 tokens) duplication in the following files: +Starting at line 55 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java +Starting at line 55 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java +Starting at line 51 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java + + private DataPackageAttachmentShadowCopyService shadowCopyService; + + private DataAcquisitionProject dataAcquisitionProject; + + private Release release; + + @Before + public void setup() { + release = new Release("1.0.0", LocalDateTime.now(), null, false); + + dataAcquisitionProject = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProject.setId(PROJECT_ID); + dataAcquisitionProject.setRelease(release); + } + + @After + public void teardown() { + Query query = new Query(GridFsCriteria.whereFilename().regex("^/data-packages")); +===================================================================== +Found a 10 line (74 tokens) duplication in the following files: +Starting at line 90 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 333 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); + + // create the survey with the given id + mockMvc.perform(put(API_SURVEYS_URI + "/" + survey.getId()) + .content(TestUtil.convertObjectToJsonBytes(survey)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); + + // read the survey under the new url + mockMvc.perform(get(API_SURVEYS_URI + "/" + survey.getId())) + .andExpect(status().isOk()); +===================================================================== +Found a 9 line (74 tokens) duplication in the following files: +Starting at line 21 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QDataSet.java +Starting at line 21 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java +Starting at line 20 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QSurvey.java + + public static final QDataPackage dataPackage = new QDataPackage("dataPackage"); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractShadowableRdcDomainObject _super = new eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractShadowableRdcDomainObject(this); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("annotations")); + + //inherited + public final StringPath createdBy = _super.createdBy; +===================================================================== +Found a 14 line (73 tokens) duplication in the following files: +Starting at line 186 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptManagementService.java +Starting at line 210 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptManagementService.java + + conceptIds.addAll(questionRepository.findSubDocumentsByIdIn(questionIds).stream() + .map(question -> question.getConceptIds() != null ? question.getConceptIds() + : new ArrayList()) + .flatMap(List::stream).collect(Collectors.toSet())); + return conceptRepository.streamIdsByIdIn(conceptIds); + }, ElasticsearchType.concepts); + } + + /** + * Enqueue update of concept search documents when the variable changed. + * + * @param variable the updated, created or deleted variable. + */ + @HandleAfterCreate +===================================================================== +Found a 13 line (73 tokens) duplication in the following files: +Starting at line 257 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 272 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java + + dataPackage.setId(dataPackage.getId() + "-1.0.0"); + + mockMvc + .perform(put(API_DATAPACKAGE_URI + "/" + dataPackage.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataPackage)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()).andExpect(jsonPath("$.errors[0].message", + containsString("global.error.shadow-save-not-allowed"))); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER) + public void testUpdateShadowCopyDataPackage() throws Exception { +===================================================================== +Found a 16 line (73 tokens) duplication in the following files: +Starting at line 57 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java +Starting at line 57 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java +Starting at line 57 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java +Starting at line 58 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionImageShadowCopyServiceTest.java +Starting at line 53 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java + + private DataAcquisitionProject dataAcquisitionProject; + + private Release release; + + @Before + public void setup() { + release = new Release("1.0.0", LocalDateTime.now(), null, false); + + dataAcquisitionProject = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProject.setId(PROJECT_ID); + dataAcquisitionProject.setRelease(release); + } + + @After + public void teardown() { + Query query = new Query(GridFsCriteria.whereFilename().regex("^/data-packages")); +===================================================================== +Found a 6 line (73 tokens) duplication in the following files: +Starting at line 110 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 144 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 108 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 139 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 124 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 155 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + mockMvc.perform(get(API_DATASETS_URI + "/" + dataSet.getId())) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.createdDate", not(isEmptyOrNullString()))) + .andExpect(jsonPath("$.lastModifiedDate", not(isEmptyOrNullString()))) + .andExpect(jsonPath("$.createdBy", is("user"))) + .andExpect(jsonPath("$.lastModifiedBy", is("user"))); +===================================================================== +Found a 11 line (73 tokens) duplication in the following files: +Starting at line 253 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 363 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java + + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); + + DataSet dataSet = UnitTestCreateDomainObjectUtils.buildDataSet(project.getId(), survey.getId(), 1); + + // create the DataSet with the given id + mockMvc.perform(put(API_DATASETS_URI + "/" + dataSet.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataSet)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); + + // delete the DataSet + mockMvc.perform(delete(API_DATASETS_URI + "/" + dataSet.getId())) +===================================================================== +Found a 12 line (72 tokens) duplication in the following files: +Starting at line 130 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 162 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java + + + "/attachments/" + attachment.getOriginalFilename())) + .andExpect(status().is2xxSuccessful()); + + // ensure the uploaded file does not exist anymore + mockMvc + .perform(get("/api/concepts/" + conceptAttachmentMetadata.getConceptId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(0))); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER, username = "test") + public void testDeleteAllAttachments() throws Exception { +===================================================================== +Found a 9 line (72 tokens) duplication in the following files: +Starting at line 135 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 146 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 146 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 137 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + .perform(get("/api/concepts/" + conceptAttachmentMetadata.getConceptId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(0))); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER, username = "test") + public void testDeleteAllAttachments() throws Exception { + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); +===================================================================== +Found a 11 line (72 tokens) duplication in the following files: +Starting at line 90 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 104 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java + + mockMvc.perform(put(API_CONCEPT_URI + "/" + concept.getId()) + .content(TestUtil.convertObjectToJsonBytes(concept)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); + + // read the concept under the new url + mockMvc.perform(get(API_CONCEPT_URI + "/" + concept.getId())).andExpect(status().isOk()); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER) + public void testCreateConceptWithPost() throws IOException, Exception { +===================================================================== +Found a 12 line (72 tokens) duplication in the following files: +Starting at line 141 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 174 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java + + + "/attachments/" + attachment.getOriginalFilename())) + .andExpect(status().is2xxSuccessful()); + + // ensure the uploaded file does not exist anymore + mockMvc.perform(get( + "/api/data-packages/" + dataPackageAttachmentMetadata.getDataPackageId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(0))); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER, username = "test") + public void testDeleteAllAttachments() throws Exception { +===================================================================== +Found a 9 line (72 tokens) duplication in the following files: +Starting at line 179 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 179 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java + + "/api/data-packages/" + dataPackageAttachmentMetadata.getDataPackageId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(0))); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER, username = "test") + public void testUpdateAttachment() throws Exception { + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); +===================================================================== +Found a 11 line (72 tokens) duplication in the following files: +Starting at line 336 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 315 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + put("/api/data-packages/" + dataPackageId + "/attachments/" + metadata.getFileName()) + .content(TestUtil.convertObjectToJsonBytes(metadata)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()).andExpect(jsonPath("$.errors[0].message", + containsString("global.error.shadow-save-not-allowed"))); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER) + public void testDeleteAllAttachmentsOfShadowCopyDataPackage() throws Exception { + String dataPackageId = "stu-issue1991-1.0.0"; +===================================================================== +Found a 12 line (72 tokens) duplication in the following files: +Starting at line 141 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 174 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java + + + "/attachments/" + attachment.getOriginalFilename())) + .andExpect(status().is2xxSuccessful()); + + // ensure the uploaded file does not exist anymore + mockMvc + .perform(get("/api/data-sets/" + dataSetAttachmentMetadata.getDataSetId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(0))); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER, username = "test") + public void testDeleteAllAttachments() throws Exception { +===================================================================== +Found a 9 line (72 tokens) duplication in the following files: +Starting at line 127 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 164 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + "/api/instruments/" + instrumentAttachmentMetadata.getInstrumentId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(0))); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER, username = "test") + public void testUpdateAttachmentMetadata() throws Exception { + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); +===================================================================== +Found a 8 line (72 tokens) duplication in the following files: +Starting at line 158 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 168 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 179 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + + project.setRelease(UnitTestCreateDomainObjectUtils.buildRelease()); + this.mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isNoContent()); + + // Assert that the last version is 1.0.0 + lastRelease = this.versionsService.findLastRelease(project.getId()); + assertThat(lastRelease.getVersion(), is("1.0.0")); +===================================================================== +Found a 11 line (72 tokens) duplication in the following files: +Starting at line 133 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 160 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + + "/attachments/" + attachment.getOriginalFilename())) + .andExpect(status().is2xxSuccessful()); + + // ensure the uploaded file does not exist anymore + mockMvc.perform(get("/api/surveys/" + surveyAttachmentMetadata.getSurveyId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(0))); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER, username = "test") + public void testDeleteAllAttachments() throws Exception { +===================================================================== +Found a 10 line (72 tokens) duplication in the following files: +Starting at line 163 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 201 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + rdcProjectRepository.save(project); + + Survey survey = Survey.builder().id("testId") + .dataAcquisitionProjectId(project.getId()) + .title(I18nString.builder().de("titel") + .en("title") + .build()) + .fieldPeriod(Period.builder().start(LocalDate.now()) + .end(LocalDate.now() + .minusDays(1)) +===================================================================== +Found a 11 line (72 tokens) duplication in the following files: +Starting at line 234 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 260 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 288 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + public void testCreateDateVariableWithOrdinalScaleLevel() throws Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + List surveyNumbers = new ArrayList<>(); + surveyNumbers.add(1); + + Variable variable = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "var1", 1, surveyNumbers); + variable.setDataType(DataTypes.DATE); + variable.setScaleLevel(ScaleLevels.ORDINAL); +===================================================================== +Found a 14 line (72 tokens) duplication in the following files: +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/QVariable.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractShadowableRdcDomainObject _super = new eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractShadowableRdcDomainObject(this); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("annotations")); + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + public final StringPath dataAcquisitionProjectId = createString("dataAcquisitionProjectId"); + + public final ListPath dataCurators = this.createList("dataCurators", eu.dzhw.fdz.metadatamanagement.common.domain.Person.class, eu.dzhw.fdz.metadatamanagement.common.domain.QPerson.class, PathInits.DIRECT2); +===================================================================== +Found a 15 line (72 tokens) duplication in the following files: +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSubDocument.java +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSubDocument.java + + public final ListPath accessWays = this.createList("accessWays", String.class, StringPath.class, PathInits.DIRECT2); + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + public final StringPath dataAcquisitionProjectId = createString("dataAcquisitionProjectId"); + + public final StringPath dataPackageId = createString("dataPackageId"); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString description; + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString format; +===================================================================== +Found a 13 line (72 tokens) duplication in the following files: +Starting at line 107 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 147 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + public final StringPath successorId = _super.successorId; + + //inherited + public final ListPath surveyIds = _super.surveyIds; + + //inherited + public final ListPath> surveyNumbers = _super.surveyNumbers; + + public final ListPath surveys = this.createList("surveys", SurveySubDocument.class, QSurveySubDocument.class, PathInits.DIRECT2); + + // custom + // inherited + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString title = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(_super.title); +===================================================================== +Found a 8 line (71 tokens) duplication in the following files: +Starting at line 199 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/rest/errors/ExceptionTranslator.java +Starting at line 215 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/rest/errors/ExceptionTranslator.java + + String domainObject = + invalidFormatException.getPath().get(0).getFrom().getClass().getSimpleName(); + String property = processor.getCurrentName(); + if (property == null) { + property = invalidFormatException.getPath().get(0).getFieldName(); + } + String invalidValue = (String) invalidFormatException.getValue(); + String messageKey = "global.error.import.excel-parsing-error"; +===================================================================== +Found a 17 line (71 tokens) duplication in the following files: +Starting at line 144 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptManagementService.java +Starting at line 186 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptManagementService.java + + conceptIds.addAll(questionRepository.findSubDocumentsByInstrumentId(instrument.getId()) + .stream().map(question -> question.getConceptIds() != null ? question.getConceptIds() + : new ArrayList()) + .flatMap(List::stream).collect(Collectors.toSet())); + return conceptRepository.streamIdsByIdIn(conceptIds); + }, ElasticsearchType.concepts); + } + + /** + * Enqueue update of concept search documents when the survey changed. + * + * @param survey the updated, created or deleted survey. + */ + @HandleAfterCreate + @HandleAfterSave + @HandleAfterDelete + public void onSurveyChanged(Survey survey) { +===================================================================== +Found a 6 line (71 tokens) duplication in the following files: +Starting at line 45 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/VariableChangesProvider.java +Starting at line 72 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/VariableChangesProvider.java + + public List getAffectedInstrumentIds(String variableId) { + List oldIds = new ArrayList<>(); + List newIds = new ArrayList<>(); + if (oldDomainObjects.get(variableId) != null + && oldDomainObjects.get(variableId).getRelatedQuestions() != null) { + for (RelatedQuestion question : oldDomainObjects.get(variableId).getRelatedQuestions()) { +===================================================================== +Found a 8 line (71 tokens) duplication in the following files: +Starting at line 135 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageShadowCopyServiceTest.java +Starting at line 142 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetShadowCopyServiceTest.java +Starting at line 135 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentShadowCopyServiceTest.java +Starting at line 126 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/service/DataAcquisitionProjectShadowCopyServiceTest.java +Starting at line 143 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionShadowCopyServiceTest.java +Starting at line 139 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyShadowCopyServiceTest.java +Starting at line 136 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/VariableShadowCopyServiceTest.java + + Optional predecessor = + result.stream().filter(s -> s.getId().equals(shadow.getId())).findFirst(); + assertThat(predecessor.isPresent(), equalTo(true)); + assertThat(predecessor.get().getSuccessorId(), equalTo(successorId)); + } + + @Test + public void createShadowCopyWithDeletedMaster() { +===================================================================== +Found a 12 line (71 tokens) duplication in the following files: +Starting at line 99 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 363 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java + + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); + + DataSet dataSet = UnitTestCreateDomainObjectUtils.buildDataSet(project.getId(), survey.getId(), 1); + + // Act and Assert + // create the variable with the given id + mockMvc.perform(put(API_DATASETS_URI + "/" + dataSet.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataSet)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); + + // check that auditing attributes have been set + mockMvc.perform(get(API_DATASETS_URI + "/" + dataSet.getId())) +===================================================================== +Found a 10 line (71 tokens) duplication in the following files: +Starting at line 460 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 495 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + variable.setScaleLevel(I18nString.builder().de("InvalidValue").en("InvalidValue").build()); + + // create the variable with a survey but without a project + mockMvc.perform(put(API_VARIABLES_URI + "/" + variable.getId()) + .content(TestUtil.convertObjectToJsonBytes(variable)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isBadRequest()); + } + + @Test + public void testCreateVariableWithoutDataType() throws Exception { +===================================================================== +Found a 8 line (71 tokens) duplication in the following files: +Starting at line 43 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 53 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 54 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java + + public final ListPath dataSets = this.createList("dataSets", DataSetSubDocument.class, QDataSetSubDocument.class, PathInits.DIRECT2); + + // custom + // inherited + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString description = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(_super.description); + + //inherited + public final StringPath doi = _super.doi; +===================================================================== +Found a 15 line (70 tokens) duplication in the following files: +Starting at line 52 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageShadowCopyServiceTest.java +Starting at line 56 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetShadowCopyServiceTest.java +Starting at line 52 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentShadowCopyServiceTest.java +Starting at line 57 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionShadowCopyServiceTest.java +Starting at line 53 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/VariableShadowCopyServiceTest.java + + private Release release; + + @Before + public void setUp() { + release = new Release("1.0.0", LocalDateTime.now(), null, false); + DataAcquisitionProject releasedProject = + UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + releasedProject.setRelease(release); + project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + project.setRelease(release); + project.setId(PROJECT_ID); + } + + @After + public void tearDown() { +===================================================================== +Found a 9 line (70 tokens) duplication in the following files: +Starting at line 86 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 154 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 78 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + + public void testCreateDataAcquisitionProject() throws IOException, Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + // create the project with the given id + mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isCreated()); + + // read the project under the new url + mockMvc.perform(get(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId())) +===================================================================== +Found a 14 line (70 tokens) duplication in the following files: +Starting at line 384 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 416 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + variable.getDistribution().getMissings().add(value2); + + // create the variable with duplicate value codes + mockMvc + .perform(put(API_VARIABLES_URI + "/" + variable.getId()) + .content(TestUtil.convertObjectToJsonBytes(variable)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) + .andExpect(jsonPath("$.errors[0].message", containsString("unique"))); + + } + + @Test + public void testCreateVariableWithNonUniqueValueClass() throws Exception { +===================================================================== +Found a 14 line (70 tokens) duplication in the following files: +Starting at line 28 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSubDocument.java + + public final ListPath conceptIds = this.createList("conceptIds", String.class, StringPath.class, PathInits.DIRECT2); + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + public final StringPath dataAcquisitionProjectId = createString("dataAcquisitionProjectId"); + + public final StringPath dataPackageId = createString("dataPackageId"); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString description = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("description")); +===================================================================== +Found a 5 line (70 tokens) duplication in the following files: +Starting at line 89 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 88 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java +Starting at line 89 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java +Starting at line 119 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + public final ListPath nestedInstruments = this.createList("nestedInstruments", InstrumentNestedDocument.class, QInstrumentNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedQuestions = this.createList("nestedQuestions", QuestionNestedDocument.class, QQuestionNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedRelatedPublications = this.createList("nestedRelatedPublications", RelatedPublicationNestedDocument.class, QRelatedPublicationNestedDocument.class, PathInits.DIRECT2); +===================================================================== +Found a 13 line (70 tokens) duplication in the following files: +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSubDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySubDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSubDocument.java + + public static final QDataPackageSubDocument dataPackageSubDocument = new QDataPackageSubDocument("dataPackageSubDocument"); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractRdcDomainObject _super = new eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractRdcDomainObject(this); + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + public final StringPath dataAcquisitionProjectId = createString("dataAcquisitionProjectId"); + + public final StringPath doi = createString("doi"); +===================================================================== +Found a 23 line (69 tokens) duplication in the following files: +Starting at line 206 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/config/JHipsterProperties.java +Starting at line 244 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/config/JHipsterProperties.java + + public boolean isEnabled() { + return enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + + public String getHost() { + return host; + } + + public void setHost(String host) { + this.host = host; + } + + public int getPort() { + return port; + } + + public void setPort(int port) { + this.port = port; + } +===================================================================== +Found a 7 line (69 tokens) duplication in the following files: +Starting at line 319 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 354 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java + + assertThat(elasticsearchAdminService.countAllDocuments(), equalTo(2L)); + + // the public user should now get the latest shadow from elastic + mockMvc.perform(get(API_DATAPACKAGE_URI + "/" + dataPackage.getMasterId())) + .andExpect(status().isOk()).andExpect(jsonPath("$.id", equalTo(dataPackage.getId()))) + .andExpect(jsonPath("$.masterId", equalTo(dataPackage.getMasterId()))) + .andExpect(jsonPath("$.release.version", equalTo("1.0.0"))) +===================================================================== +Found a 11 line (69 tokens) duplication in the following files: +Starting at line 386 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 422 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java + + rdcProjectRepository.save(project); + + mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .content(TestUtil.convertObjectToJsonBytes(project)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isNoContent()); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER, username = PUBLISHER_USERNAME) + public void testUpdateRequiredObjectTypes_badRequest() throws Exception { +===================================================================== +Found a 8 line (69 tokens) duplication in the following files: +Starting at line 33 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 33 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java +Starting at line 31 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java +Starting at line 34 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString completeTitle; + + public final ListPath concepts = this.createList("concepts", ConceptSubDocument.class, QConceptSubDocument.class, PathInits.DIRECT2); + + public final eu.dzhw.fdz.metadatamanagement.projectmanagement.domain.QConfiguration configuration; + + //inherited + public final StringPath createdBy = _super.createdBy; +===================================================================== +Found a 17 line (69 tokens) duplication in the following files: +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSubDocument.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/QVariable.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractRdcDomainObject _super = new eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractRdcDomainObject(this); + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + public final StringPath dataAcquisitionProjectId = createString("dataAcquisitionProjectId"); + + public final StringPath dataPackageId = createString("dataPackageId"); + + public final StringPath dataSetId = createString("dataSetId"); + + public final NumberPath dataSetNumber = createNumber("dataSetNumber", Integer.class); + + public final StringPath id = createString("id"); +===================================================================== +Found a 6 line (68 tokens) duplication in the following files: +Starting at line 100 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 127 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java + + mockMvc.perform(get(API_DATAPACKAGE_URI)).andExpect(status().isOk()) + .andExpect(jsonPath("$.content.length()", is(0))); + + // get the empty list of pinned data packages + mockMvc.perform(get(API_DATAPACKAGE_URI + "?pinned=true")).andExpect(status().isOk()) + .andExpect(jsonPath("$.content.length()", is(0))); +===================================================================== +Found a 12 line (68 tokens) duplication in the following files: +Starting at line 129 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java +Starting at line 191 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java + + assertThat(files.size(), equalTo(2)); + + Query shadowQuery = new Query(GridFsCriteria.whereFilename() + .is("/data-packages/stu-" + PROJECT_ID + "$-1.0.0/attachments/filename.txt")); + GridFSFile shadowFile = gridFsOperations.findOne(shadowQuery); + + assertThat(shadowFile, notNullValue()); + + DataPackageAttachmentMetadata metadata = + mongoTemplate.getConverter().read(DataPackageAttachmentMetadata.class, shadowFile.getMetadata()); + + assertThat(metadata.getSuccessorId(), nullValue()); +===================================================================== +Found a 14 line (68 tokens) duplication in the following files: +Starting at line 163 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 198 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java + + this.surveyRepository.save(survey); + + DataSet dataSet = UnitTestCreateDomainObjectUtils.buildDataSet(null, survey.getId(), 1); + + + // Act and Assert + // create the DataSet with a survey but without a project + mockMvc.perform(put(API_DATASETS_URI + "/" + dataSet.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataSet)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()); + } + + @Test + public void testCreateDataSetWithWrongFormat() throws Exception { +===================================================================== +Found a 12 line (68 tokens) duplication in the following files: +Starting at line 129 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java +Starting at line 191 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java + + assertThat(files.size(), equalTo(2)); + + Query shadowQuery = new Query(GridFsCriteria.whereFilename() + .is("/data-sets/dat-" + PROJECT_ID + "-ds1$-1.0.0/attachments/filename.txt")); + GridFSFile shadowFile = gridFsOperations.findOne(shadowQuery); + + assertThat(shadowFile, notNullValue()); + + DataSetAttachmentMetadata metadata = mongoTemplate.getConverter() + .read(DataSetAttachmentMetadata.class, shadowFile.getMetadata()); + + assertThat(metadata.getSuccessorId(), nullValue()); +===================================================================== +Found a 12 line (68 tokens) duplication in the following files: +Starting at line 129 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java +Starting at line 194 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java + + assertThat(files.size(), equalTo(2)); + + Query shadowQuery = new Query(GridFsCriteria.whereFilename() + .is("/instruments/ins-" + PROJECT_ID + "-ins1$-1.0.0/attachments/filename.txt")); + GridFSFile shadowFile = gridFsOperations.findOne(shadowQuery); + + assertThat(shadowFile, notNullValue()); + + InstrumentAttachmentMetadata metadata = mongoTemplate.getConverter() + .read(InstrumentAttachmentMetadata.class, shadowFile.getMetadata()); + + assertThat(metadata.getSuccessorId(), nullValue()); +===================================================================== +Found a 12 line (68 tokens) duplication in the following files: +Starting at line 130 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionImageShadowCopyServiceTest.java +Starting at line 192 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionImageShadowCopyServiceTest.java + + assertThat(files.size(), equalTo(2)); + + Query shadowQuery = new Query(GridFsCriteria.whereFilename() + .is("/questions/que-" + PROJECT_ID + "-ins1-1.1$-1.0.0/images/TestFileName.PNG")); + GridFSFile shadowFile = gridFsOperations.findOne(shadowQuery); + + assertThat(shadowFile, notNullValue()); + + QuestionImageMetadata metadata = + mongoTemplate.getConverter().read(QuestionImageMetadata.class, shadowFile.getMetadata()); + + assertThat(metadata.getSuccessorId(), nullValue()); +===================================================================== +Found a 11 line (68 tokens) duplication in the following files: +Starting at line 234 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 260 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 288 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 842 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + public void testCreateDateVariableWithOrdinalScaleLevel() throws Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + List surveyNumbers = new ArrayList<>(); + surveyNumbers.add(1); + + Variable variable = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "var1", 1, surveyNumbers); + variable.setDataType(DataTypes.DATE); + variable.setScaleLevel(ScaleLevels.ORDINAL); +===================================================================== +Found a 18 line (68 tokens) duplication in the following files: +Starting at line 41 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java +Starting at line 43 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QSurvey.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString description = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("description")); + + //inherited + public final BooleanPath hidden = _super.hidden; + + public final StringPath id = createString("id"); + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + public final StringPath masterId = createString("masterId"); + + public final NumberPath number = createNumber("number", Integer.class); + + public final ListPath originalLanguages = this.createList("originalLanguages", String.class, StringPath.class, PathInits.DIRECT2); +===================================================================== +Found a 6 line (68 tokens) duplication in the following files: +Starting at line 76 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 97 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 92 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java +Starting at line 85 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 104 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java + + public final ListPath nestedSurveys = this.createList("nestedSurveys", SurveyNestedDocument.class, QSurveyNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedVariables = this.createList("nestedVariables", VariableNestedDocument.class, QVariableNestedDocument.class, PathInits.DIRECT2); + + //inherited + public final SetPath originalLanguages = _super.originalLanguages; +===================================================================== +Found a 7 line (68 tokens) duplication in the following files: +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/QVariable.java + + public final eu.dzhw.fdz.metadatamanagement.datapackagemanagement.domain.QDataPackage _super = new eu.dzhw.fdz.metadatamanagement.datapackagemanagement.domain.QDataPackage(this); + + public final ListPath accessWays = this.createList("accessWays", String.class, StringPath.class, PathInits.DIRECT2); + + // custom + // inherited + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(_super.annotations); +===================================================================== +Found a 3 line (68 tokens) duplication in the following files: +Starting at line 166 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 149 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java +Starting at line 147 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 166 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 156 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java +Starting at line 178 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + this.completeTitle = inits.isInitialized("completeTitle") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("completeTitle")) : null; + this.configuration = inits.isInitialized("configuration") ? new eu.dzhw.fdz.metadatamanagement.projectmanagement.domain.QConfiguration(forProperty("configuration")) : null; + this.guiLabels = inits.isInitialized("guiLabels") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("guiLabels")) : null; +===================================================================== +Found a 19 line (67 tokens) duplication in the following files: +Starting at line 29 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/ValidResponseValueMustBeANumberOnNumericDataTypeValidator.java +Starting at line 29 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/ValidResponseValueMustBeAnIsoDateOnDateDataTypeValidator.java + + ValidResponseValueMustBeANumberOnNumericDataType constraintAnnotation) {} + + /* + * (non-Javadoc) + * + * @see javax.validation.ConstraintValidator#isValid(java.lang.Object, + * javax.validation.ConstraintValidatorContext) + */ + @Override + public boolean isValid(Variable variable, ConstraintValidatorContext context) { + + if (variable == null || variable.getDataType() == null + || variable.getDistribution() == null + || variable.getDistribution().getValidResponses() == null) { + return true; + } + + if (variable.getDataType() + .equals(DataTypes.NUMERIC)) { +===================================================================== +Found a 9 line (67 tokens) duplication in the following files: +Starting at line 140 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 196 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java + + DataPackage dataPackage = UnitTestCreateDomainObjectUtils.buildDataPackage(project.getId()); + + // create the dataPackage with the given id + mockMvc.perform(put(API_DATAPACKAGE_URI + "/" + dataPackage.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataPackage)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); + + // release the project + project.setRelease(UnitTestCreateDomainObjectUtils.buildRelease()); +===================================================================== +Found a 7 line (67 tokens) duplication in the following files: +Starting at line 86 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/AvailableDataSetNumbersResourceControllerTest.java +Starting at line 78 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/AvailableInstrumentNumbersResourceControllerTest.java +Starting at line 77 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/AvailableSurveyNumbersResourceControllerTest.java + + + "/available-data-set-numbers")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(3))) + .andExpect(jsonPath("$.[0]", is(1))).andExpect(jsonPath("$.[1]", is(2))) + .andExpect(jsonPath("$.[2]", is(4))); + } + +} +===================================================================== +Found a 9 line (67 tokens) duplication in the following files: +Starting at line 282 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 363 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java + + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); + + DataSet dataSet = UnitTestCreateDomainObjectUtils.buildDataSet(project.getId(), survey.getId(), 1); + + // Act and Assert + // create the DataSet with the given id + mockMvc.perform(put(API_DATASETS_URI + "/" + dataSet.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataSet)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 11 line (67 tokens) duplication in the following files: +Starting at line 219 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 280 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 339 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 397 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java + + question.getSuccessors().add("testProject-WrongQuestion"); + this.questionRepository.save(question); + QuestionImageMetadata questionImageMetadata = + UnitTestCreateDomainObjectUtils.buildQuestionImageMetadata(project.getId(), question.getId()); + UnitTestImageHelper.saveQuestionImage(this.questionImageService, questionImageMetadata); + + + // Act & Assert + mockMvc.perform(post(API_DATA_ACQUISITION_PROJECTS_POST_VALIDATION_URI)) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.errors", hasSize(2))) +===================================================================== +Found a 11 line (67 tokens) duplication in the following files: +Starting at line 334 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 365 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java + + Configuration invalidConf = new Configuration(); + project.setConfiguration(invalidConf); + mockMvc + .perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))) + .andExpect(status().isBadRequest()); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.DATA_PROVIDER) +===================================================================== +Found a 9 line (67 tokens) duplication in the following files: +Starting at line 338 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java +Starting at line 356 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java + + "funky@example.com", // e-mail + true, // activated + "en", // langKey + new HashSet<>(Arrays.asList(AuthoritiesConstants.USER)), false); + + restUserMockMvc.perform(post("/api/register").contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(u))).andExpect(status().isBadRequest()); + + Optional user = userRepository.findOneByEmail("funky@example.com"); +===================================================================== +Found a 10 line (67 tokens) duplication in the following files: +Starting at line 451 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 608 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + public void testCreateVariableWithInvalidScaleLevel() throws Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + List surveyNumbers = new ArrayList<>(); + surveyNumbers.add(1); + + Variable variable = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "var1", 1, surveyNumbers); + variable.setScaleLevel(I18nString.builder().de("InvalidValue").en("InvalidValue").build()); +===================================================================== +Found a 12 line (67 tokens) duplication in the following files: +Starting at line 55 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 70 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java + + public final StringPath id = _super.id; + + public final ListPath instruments = this.createList("instruments", InstrumentSubDocument.class, QInstrumentSubDocument.class, PathInits.DIRECT2); + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + //inherited + public final StringPath license = _super.license; +===================================================================== +Found a 14 line (67 tokens) duplication in the following files: +Starting at line 72 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 85 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java + + public final ListPath instruments = this.createList("instruments", InstrumentSubDocument.class, QInstrumentSubDocument.class, PathInits.DIRECT2); + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + //inherited + public final StringPath masterId = _super.masterId; + + public final ListPath nestedConcepts = this.createList("nestedConcepts", ConceptNestedDocument.class, QConceptNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedDataSets = this.createList("nestedDataSets", DataSetNestedDocument.class, QDataSetNestedDocument.class, PathInits.DIRECT2); +===================================================================== +Found a 4 line (67 tokens) duplication in the following files: +Starting at line 149 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 158 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java +Starting at line 181 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + this.dataPackage = inits.isInitialized("dataPackage") ? new QDataPackageSubDocument(forProperty("dataPackage"), inits.get("dataPackage")) : null; + this.guiLabels = inits.isInitialized("guiLabels") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("guiLabels")) : null; + this.nestedDataPackage = inits.isInitialized("nestedDataPackage") ? new QDataPackageNestedDocument(forProperty("nestedDataPackage"), inits.get("nestedDataPackage")) : null; + this.release = inits.isInitialized("release") ? new eu.dzhw.fdz.metadatamanagement.projectmanagement.domain.QRelease(forProperty("release")) : null; +===================================================================== +Found a 14 line (66 tokens) duplication in the following files: +Starting at line 28 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/StatisticsFirstQuartileMustBeANumberOnNumericDataTypeValidator.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/StatisticsFirstQuartileMustBeAnIsoDateOnDateDataTypeValidator.java + + StatisticsFirstQuartileMustBeANumberOnNumericDataType constraintAnnotation) {} + + /* + * (non-Javadoc) + * + * @see javax.validation.ConstraintValidator#isValid(java.lang.Object, + * javax.validation.ConstraintValidatorContext) + */ + @Override + public boolean isValid(Variable variable, ConstraintValidatorContext context) { + + if (variable == null || variable.getDataType() == null || variable.getDistribution() == null + || variable.getDistribution().getStatistics() == null + || variable.getDistribution().getStatistics().getFirstQuartile() == null +===================================================================== +Found a 15 line (66 tokens) duplication in the following files: +Starting at line 28 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/StatisticsMaximumMustBeANumberOnNumericDataTypeValidator.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/StatisticsMaximumMustBeAnIsoDateOnDateDataTypeValidator.java + + StatisticsMaximumMustBeANumberOnNumericDataType constraintAnnotation) {} + + /* + * (non-Javadoc) + * + * @see javax.validation.ConstraintValidator#isValid(java.lang.Object, + * javax.validation.ConstraintValidatorContext) + */ + @Override + public boolean isValid(Variable variable, ConstraintValidatorContext context) { + + if (variable == null || variable.getDataType() == null + || variable.getDistribution() == null + || variable.getDistribution().getStatistics() == null + || variable.getDistribution().getStatistics().getMaximum() == null +===================================================================== +Found a 15 line (66 tokens) duplication in the following files: +Starting at line 28 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/StatisticsMedianMustBeANumberOnNumericDataTypeValidator.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/StatisticsMedianMustBeAnIsoDateOnDateDataTypeValidator.java + + StatisticsMedianMustBeANumberOnNumericDataType constraintAnnotation) {} + + /* + * (non-Javadoc) + * + * @see javax.validation.ConstraintValidator#isValid(java.lang.Object, + * javax.validation.ConstraintValidatorContext) + */ + @Override + public boolean isValid(Variable variable, ConstraintValidatorContext context) { + + if (variable == null || variable.getDataType() == null + || variable.getDistribution() == null + || variable.getDistribution().getStatistics() == null + || variable.getDistribution().getStatistics().getMedian() == null +===================================================================== +Found a 16 line (66 tokens) duplication in the following files: +Starting at line 28 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/StatisticsMinimumMustBeANumberOnNumericDataTypeValidator.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/StatisticsMinimumMustBeAnIsoDateOnDateDataTypeValidator.java + + StatisticsMinimumMustBeANumberOnNumericDataType constraintAnnotation) {} + + /* + * (non-Javadoc) + * + * @see javax.validation.ConstraintValidator#isValid(java.lang.Object, + * javax.validation.ConstraintValidatorContext) + */ + @Override + public boolean isValid(Variable variable, ConstraintValidatorContext context) { + + if (variable == null + || variable.getDataType() == null + || variable.getDistribution() == null + || variable.getDistribution().getStatistics() == null + || variable.getDistribution().getStatistics().getMinimum() == null +===================================================================== +Found a 15 line (66 tokens) duplication in the following files: +Starting at line 28 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/StatisticsThirdQuartileMustBeANumberOnNumericDataTypeValidator.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/StatisticsThirdQuartileMustBeAnIsoDateOnDateDataTypeValidator.java + + StatisticsThirdQuartileMustBeANumberOnNumericDataType constraintAnnotation) {} + + /* + * (non-Javadoc) + * + * @see javax.validation.ConstraintValidator#isValid(java.lang.Object, + * javax.validation.ConstraintValidatorContext) + */ + @Override + public boolean isValid(Variable variable, ConstraintValidatorContext context) { + + if (variable == null || variable.getDataType() == null + || variable.getDistribution() == null + || variable.getDistribution().getStatistics() == null + || variable.getDistribution().getStatistics().getThirdQuartile() == null +===================================================================== +Found a 13 line (66 tokens) duplication in the following files: +Starting at line 153 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 80 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentVersionsResourceTest.java + + current.setType(InstrumentAttachmentTypes.OTHER); + + mockMvc + .perform(put("/api/instruments/" + instrumentAttachmentMetadata.getInstrumentId() + + "/attachments/" + attachment.getOriginalFilename()) + .content(TestUtil.convertObjectToJsonBytes(current)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isNoContent()); + + // read the updated attachment and check the version + mockMvc + .perform(get( + "/api/instruments/" + instrumentAttachmentMetadata.getInstrumentId() + "/attachments")) +===================================================================== +Found a 13 line (66 tokens) duplication in the following files: +Starting at line 168 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 188 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java + + UnitTestCreateDomainObjectUtils.buildRelatedPublication("TestAuthors", 1959); + + // ACT + this.mockMvc + .perform(put(API_RELATED_PUBLICATION_URI + "/" + relatedPublication.getId()) + .content(TestUtil.convertObjectToJsonBytes(relatedPublication)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()).andExpect(jsonPath("$.errors[0].message", + containsString("related-publication-management.error.related-publication.year.valid"))); + } + + @Test + public void testCreateRelatedPublicationsWithInvalidYearInFuture() throws IOException, Exception { +===================================================================== +Found a 12 line (66 tokens) duplication in the following files: +Starting at line 241 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResponseRateImageResourceTest.java +Starting at line 218 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyResponseRateImageShadowCopyServiceTest.java + + } + + private void createTestFileForSurveyRateImage(SurveyResponseRateImageMetadata metadata) + throws Exception { + + try (InputStream is = new ByteArrayInputStream("fakeimage".getBytes(StandardCharsets.UTF_8))) { + String filename = + String.format("/surveys/%s/%s", metadata.getSurveyId(), metadata.getFileName()); + gridFsMetadataUpdateService.store(is, filename, "image/png", metadata); + } + } +} +===================================================================== +Found a 10 line (66 tokens) duplication in the following files: +Starting at line 234 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 260 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 288 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 823 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 842 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + public void testCreateDateVariableWithOrdinalScaleLevel() throws Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + List surveyNumbers = new ArrayList<>(); + surveyNumbers.add(1); + + Variable variable = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "var1", 1, surveyNumbers); + variable.setDataType(DataTypes.DATE); +===================================================================== +Found a 11 line (66 tokens) duplication in the following files: +Starting at line 676 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 696 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 716 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + public void testFilterExpressionLanguageIsEmpty() throws Exception { + // Arrange + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + List surveyNumbers = new ArrayList<>(); + surveyNumbers.add(1); + + Variable variable = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "var1", 1, surveyNumbers); + variable.getFilterDetails().setExpressionLanguage(null); +===================================================================== +Found a 11 line (66 tokens) duplication in the following files: +Starting at line 736 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 756 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 776 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + public void testRuleExpressionLanguageIsEmpty() throws Exception { + // Arrange + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + List surveyNumbers = new ArrayList<>(); + surveyNumbers.add(1); + + Variable variable = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "var1", 1, surveyNumbers); + variable.getGenerationDetails().setRuleExpressionLanguage(null); +===================================================================== +Found a 15 line (66 tokens) duplication in the following files: +Starting at line 35 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageNestedDocument.java +Starting at line 37 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveyNestedDocument.java + + public final StringPath id = createString("id"); + + //inherited + public final StringPath lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate; + + public final StringPath masterId = createString("masterId"); + + public final BooleanPath shadow = createBoolean("shadow"); + + public final StringPath successorId = createString("successorId"); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString title; +===================================================================== +Found a 11 line (66 tokens) duplication in the following files: +Starting at line 75 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 69 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java + + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + //inherited + public final StringPath masterId = _super.masterId; + + public final ListPath nestedConcepts = this.createList("nestedConcepts", ConceptNestedDocument.class, QConceptNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedDataSets = this.createList("nestedDataSets", DataSetNestedDocument.class, QDataSetNestedDocument.class, PathInits.DIRECT2); +===================================================================== +Found a 2 line (66 tokens) duplication in the following files: +Starting at line 82 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveyNestedDocument.java +Starting at line 92 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySubDocument.java + + this.surveyMethod = inits.isInitialized("surveyMethod") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("surveyMethod")) : null; + this.title = inits.isInitialized("title") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("title")) : null; +===================================================================== +Found a 16 line (65 tokens) duplication in the following files: +Starting at line 76 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptAttachmentService.java +Starting at line 113 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptAttachmentService.java + + ConceptAttachmentFilenameBuilder.buildFileNamePrefix(conceptId)))); + Iterable files = this.operations.find(query); + files.forEach(file -> { + ConceptAttachmentMetadata metadata = mongoTemplate.getConverter().read( + ConceptAttachmentMetadata.class, file.getMetadata()); + javers.commitShallowDelete(currentUser, metadata); + }); + this.operations.delete(query); + } + + /** + * Load all metadata objects from gridfs (ordered by indexInConcept). + * @param conceptId The id of the {@link Concept}. + * @return A list of metadata. + */ + public List findAllByConcept(String conceptId) { +===================================================================== +Found a 10 line (65 tokens) duplication in the following files: +Starting at line 336 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 337 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 315 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + put("/api/data-packages/" + dataPackageId + "/attachments/" + metadata.getFileName()) + .content(TestUtil.convertObjectToJsonBytes(metadata)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()).andExpect(jsonPath("$.errors[0].message", + containsString("global.error.shadow-save-not-allowed"))); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER) + public void testDeleteAllAttachmentsOfShadowCopyDataPackage() throws Exception { +===================================================================== +Found a 12 line (65 tokens) duplication in the following files: +Starting at line 121 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 197 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java + + + "/attachments/" + attachment.getOriginalFilename())) + .andExpect(status().is2xxSuccessful()); + + // ensure the uploaded file does not exist anymore + mockMvc + .perform(get( + "/api/instruments/" + instrumentAttachmentMetadata.getInstrumentId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(0))); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER, username = "test") +===================================================================== +Found a 14 line (64 tokens) duplication in the following files: +Starting at line 144 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptManagementService.java +Starting at line 210 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptManagementService.java + + conceptIds.addAll(questionRepository.findSubDocumentsByInstrumentId(instrument.getId()) + .stream().map(question -> question.getConceptIds() != null ? question.getConceptIds() + : new ArrayList()) + .flatMap(List::stream).collect(Collectors.toSet())); + return conceptRepository.streamIdsByIdIn(conceptIds); + }, ElasticsearchType.concepts); + } + + /** + * Enqueue update of concept search documents when the survey changed. + * + * @param survey the updated, created or deleted survey. + */ + @HandleAfterCreate +===================================================================== +Found a 20 line (64 tokens) duplication in the following files: +Starting at line 126 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageOverviewService.java +Starting at line 208 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetReportService.java + + } + + // Save into MongoDB / GridFS + File zipTmpFile = zipTmpFilePath.toFile(); + String fileName = this.saveCompleteZipFile(zipTmpFile, originalName); + log.debug("file saved, start #handletaskDone"); + taskService.handleTaskDone(task, fileName); + } catch (IOException e) { + log.error("failed generating report", e); + taskService.handleErrorTask(task, e); + } + } + + /** + * Checks for all files which are included for the tex template. + * + * @param zipFileSystem The zip file as file system + * @return True if all files are included. False min one file is missing. + */ + private List validateDataPackageOverviewStructure(FileSystem zipFileSystem) { +===================================================================== +Found a 11 line (64 tokens) duplication in the following files: +Starting at line 444 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 551 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java + + new DataSetSearchDocument(dataSet, dataPackage, variableProjections, + surveys, instruments, questions, concepts, release, doi, configuration); + + request.add(new IndexRequest(lockedItem.getDocumentType().name()).id(searchDocument.getId()) + .source(gson.toJson(searchDocument), XContentType.JSON)); + return true; + } + return false; + } + + private boolean addUpsertActionForSurvey(ElasticsearchUpdateQueueItem lockedItem, +===================================================================== +Found a 10 line (64 tokens) duplication in the following files: +Starting at line 86 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 153 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 68 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java + + public void testCreateConcept() throws IOException, Exception { + Concept concept = UnitTestCreateDomainObjectUtils.buildConcept(); + + // create the concept with the given id + mockMvc.perform(put(API_CONCEPT_URI + "/" + concept.getId()) + .content(TestUtil.convertObjectToJsonBytes(concept)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); + + // read the concept under the new url + mockMvc.perform(get(API_CONCEPT_URI + "/" + concept.getId())).andExpect(status().isOk()); +===================================================================== +Found a 9 line (64 tokens) duplication in the following files: +Starting at line 148 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 205 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java + + project.setRelease(UnitTestCreateDomainObjectUtils.buildRelease()); + mockMvc.perform(put("/api/data-acquisition-projects" + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isNoContent()); + shadowCopyQueueItemService.executeShadowCopyActions(); + + UnitTestUserManagementUtils.logout(); + // ensure that there are still no pinned data packages + mockMvc.perform(get(API_DATAPACKAGE_URI + "?pinned=true")).andExpect(status().isOk()) +===================================================================== +Found a 9 line (64 tokens) duplication in the following files: +Starting at line 159 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 186 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java + + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isCreated()); + + // load the project with the projection + mockMvc + .perform( + get(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()).andExpect(jsonPath("$.id", is(project.getId()))) + .andExpect(jsonPath("$.version", is(0))); +===================================================================== +Found a 12 line (64 tokens) duplication in the following files: +Starting at line 126 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java +Starting at line 188 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java + + assertThat(files.size(), equalTo(2)); + + Query shadowQuery = new Query(GridFsCriteria.whereFilename() + .is("/surveys/sur-the-dataacquisition-project-id-sy1$-1.0.0/attachments/filename.txt")); + GridFSFile shadowFile = gridFsOperations.findOne(shadowQuery); + + assertThat(shadowFile, notNullValue()); + + SurveyAttachmentMetadata metadata = + mongoTemplate.getConverter().read(SurveyAttachmentMetadata.class, shadowFile.getMetadata()); + + assertThat(metadata.getSuccessorId(), nullValue()); +===================================================================== +Found a 10 line (64 tokens) duplication in the following files: +Starting at line 346 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 736 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 756 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 776 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + public void testGenerationDetailsWithExpressionLanguageButWithoutRule() throws Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + List surveyNumbers = new ArrayList<>(); + surveyNumbers.add(1); + + Variable variable = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "var1", 1, surveyNumbers); + variable.getGenerationDetails().setRule(null); +===================================================================== +Found a 10 line (63 tokens) duplication in the following files: +Starting at line 139 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java +Starting at line 154 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java + + List emailAddresses = admins.stream().map(User::getEmail).collect(Collectors.toList()); + return sendEmail(null, emailAddresses.toArray(new String[emailAddresses.size()]), null, null, + subject, content, false, true); + } + + /** + * Send an mail, if an automatic update to dara was not successful. + */ + @Async + public Future sendMailOnDaraAutomaticUpdateError(List admins, String projectId) { +===================================================================== +Found a 13 line (63 tokens) duplication in the following files: +Starting at line 627 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 811 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + mockMvc.perform(delete(API_VARIABLES_URI + "/" + variable.getId())) + .andExpect(status().is2xxSuccessful()); + + // check that the variable has been deleted + mockMvc.perform(get(API_VARIABLES_URI + "/" + variable.getId())) + .andExpect(status().isNotFound()); + + // check that there are no variable search documents anymore + assertThat(elasticsearchAdminService.countAllDocuments(), equalTo(0L)); + } + + @Test + public void testUpdateVariable() throws Exception { +===================================================================== +Found a 12 line (63 tokens) duplication in the following files: +Starting at line 50 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/domain/QConcept.java +Starting at line 70 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java + + public final SetPath originalLanguages = this.createSet("originalLanguages", String.class, StringPath.class, PathInits.DIRECT2); + + // custom + public final QTags tags = new QTags(forProperty("tags")); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString title = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("title")); + + //inherited + public final NumberPath version = _super.version; + + public QConcept(String variable) { +===================================================================== +Found a 10 line (62 tokens) duplication in the following files: +Starting at line 64 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptAttachmentVersionsService.java +Starting at line 65 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentVersionsService.java +Starting at line 66 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentVersionsService.java +Starting at line 67 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentVersionsService.java +Starting at line 72 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentVersionsService.java + + ConceptAttachmentMetadata metadata = shadow.get(); + if (metadata.getId() == null) { + // deleted shadow + metadata.setLastModifiedBy(shadow.getCommitMetadata().getAuthor()); + metadata.setLastModifiedDate(shadow.getCommitMetadata().getCommitDate()); + } + return metadata; + }).collect(Collectors.toList()); + } +} +===================================================================== +Found a 11 line (62 tokens) duplication in the following files: +Starting at line 357 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 599 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java + + new InstrumentSearchDocument(instrument, dataPackage, surveys, questions, variables, + dataSets, concepts, release, doi, configuration); + + request.add(new IndexRequest(lockedItem.getDocumentType().name()).id(searchDocument.getId()) + .source(gson.toJson(searchDocument), XContentType.JSON)); + return true; + } + return false; + } + + private boolean addUpsertActionForRelatedPublication(ElasticsearchUpdateQueueItem lockedItem, +===================================================================== +Found a 6 line (62 tokens) duplication in the following files: +Starting at line 420 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 534 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java + + List questions = + questionRepository.findSubDocumentsByIdIn(questionIds); + Set conceptIds = questions.stream() + .map(question -> question.getConceptIds() != null ? question.getConceptIds() + : new ArrayList()) + .flatMap(List::stream).collect(Collectors.toSet()); +===================================================================== +Found a 10 line (62 tokens) duplication in the following files: +Starting at line 219 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 239 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java + + conceptAttachmentMetadata.setType(new I18nString("hurz","hurz")); + MockMultipartFile metadata = new MockMultipartFile("conceptAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(conceptAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/concepts/attachments") + .file(attachment) + .file(metadata)) + .andExpect(status().isBadRequest()) + .andExpect(jsonPath("$.errors[0].message", + is("concept-management.error.concept-attachment-metadata.type.valid-type"))); +===================================================================== +Found a 9 line (62 tokens) duplication in the following files: +Starting at line 237 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 256 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java + + dataPackageAttachmentMetadata.setType(new I18nString("hurz", "hurz")); + MockMultipartFile metadata = new MockMultipartFile("dataPackageAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(dataPackageAttachmentMetadata)); + + mockMvc + .perform(MockMvcRequestBuilders.multipart("/api/data-packages/attachments").file(attachment) + .file(metadata)) + .andExpect(status().isBadRequest()).andExpect(jsonPath("$.errors[0].message", + is("data-package-management.error.data-package-attachment-metadata.type.valid-type"))); +===================================================================== +Found a 9 line (62 tokens) duplication in the following files: +Starting at line 215 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 234 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java + + instrumentAttachmentMetadata.setType(new I18nString("hurz", "hurz")); + MockMultipartFile metadata = new MockMultipartFile("instrumentAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(instrumentAttachmentMetadata)); + + mockMvc + .perform(MockMvcRequestBuilders.multipart("/api/instruments/attachments").file(attachment) + .file(metadata)) + .andExpect(status().isBadRequest()).andExpect(jsonPath("$.errors[0].message", + is("instrument-management.error.instrument-attachment-metadata.type.valid-type"))); +===================================================================== +Found a 9 line (62 tokens) duplication in the following files: +Starting at line 127 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 187 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 246 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 308 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java + + this.rdcProjectRepository.save(project); + + //Survey + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); + this.surveyRepository.save(survey); + List surveyNumbers = new ArrayList<>(); + surveyNumbers.add(1); + List listOfSurveyIds = new ArrayList<>(); + listOfSurveyIds.add(survey.getId()); +===================================================================== +Found a 8 line (62 tokens) duplication in the following files: +Starting at line 201 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResourceTest.java +Starting at line 212 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResourceTest.java + + project.getRelease().setVersion(version);; + this.mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isNoContent()); + shadowCopyQueueItemService.executeShadowCopyActions(); + // shadow copy thread authenticates itself therefore we need to login again + UnitTestUserManagementUtils.login("admin", "admin"); + } +===================================================================== +Found a 12 line (62 tokens) duplication in the following files: +Starting at line 103 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 135 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 797 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + public void testCreateVariable() throws Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + List surveyNumbers = new ArrayList<>(); + surveyNumbers.add(1); + + Variable variable = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "var1", 1, surveyNumbers); + + // create the variable with the given id + mockMvc.perform(put(API_VARIABLES_URI + "/" + variable.getId()) +===================================================================== +Found a 10 line (62 tokens) duplication in the following files: +Starting at line 180 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 451 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + public void testCreateVariableWithoutScaleLevel() throws Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + List surveyNumbers = new ArrayList<>(); + surveyNumbers.add(1); + + Variable variable = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "var1", 1, surveyNumbers); + variable.setScaleLevel(null); +===================================================================== +Found a 10 line (62 tokens) duplication in the following files: +Starting at line 234 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 260 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 288 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 469 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 486 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 823 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 842 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + public void testCreateDateVariableWithOrdinalScaleLevel() throws Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + List surveyNumbers = new ArrayList<>(); + surveyNumbers.add(1); + + Variable variable = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "var1", 1, surveyNumbers); + variable.setDataType(DataTypes.DATE); +===================================================================== +Found a 21 line (62 tokens) duplication in the following files: +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptNestedDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageNestedDocument.java + + public static final QConceptNestedDocument conceptNestedDocument = new QConceptNestedDocument("conceptNestedDocument"); + + public final QAbstractNestedSubDocument _super; + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString completeTitle; + + //inherited + public final StringPath createdBy; + + //inherited + public final DateTimePath createdDate; + + public final StringPath id = createString("id"); + + //inherited + public final StringPath lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate; + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString title; +===================================================================== +Found a 8 line (61 tokens) duplication in the following files: +Starting at line 324 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java +Starting at line 403 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java + + log.debug("Sending 'dataset report error' mail"); + Locale locale = Locale.forLanguageTag(onBehalfUser.getLangKey()); + Context context = new Context(locale); + context.setVariable("onBehalfUser", onBehalfUser); + context.setVariable("taskErrorNotification", errorNotification); + context.setVariable("locale", locale); + context.setVariable("baseUrl", baseUrl); + String content = templateEngine.process("datasetReportErrorEmail", context); +===================================================================== +Found a 14 line (61 tokens) duplication in the following files: +Starting at line 34 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/repository/DaraUpdateQueueItemRepositoryImpl.java +Starting at line 34 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/repository/ElasticsearchUpdateQueueItemRepositoryImpl.java + + private final MongoOperations mongoOperations; + + /* + * (non-Javadoc) + * @see eu.dzhw.fdz.metadatamanagement.projectmanagement.repository + * .DaraUpdateQueueItemRepositoryCustom + * #lockAllUnlockedOrExpiredItems(java.time.LocalDateTime, java.lang.String) + */ + @Override + public void lockAllUnlockedOrExpiredItems(LocalDateTime updateStartedAt, String updateStartedBy) { + Query query = new Query(getUnlockedOrExpiredCriteria()).limit(BULK_SIZE); + Update update = new Update() + .set("updateStartedAt", updateStartedAt).set("updateStartedBy", updateStartedBy); + mongoOperations.updateMulti(query, update, DaraUpdateQueueItem.class); +===================================================================== +Found a 10 line (61 tokens) duplication in the following files: +Starting at line 445 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 481 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 551 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java + + surveys, instruments, questions, concepts, release, doi, configuration); + + request.add(new IndexRequest(lockedItem.getDocumentType().name()).id(searchDocument.getId()) + .source(gson.toJson(searchDocument), XContentType.JSON)); + return true; + } + return false; + } + + private boolean addUpsertActionForSurvey(ElasticsearchUpdateQueueItem lockedItem, +===================================================================== +Found a 14 line (61 tokens) duplication in the following files: +Starting at line 28 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/StatisticsFirstQuartileMustBeANumberOnNumericDataTypeValidator.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/StatisticsFirstQuartileMustBeAnIsoDateOnDateDataTypeValidator.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/StatisticsMaximumMustBeANumberOnNumericDataTypeValidator.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/StatisticsMaximumMustBeAnIsoDateOnDateDataTypeValidator.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/StatisticsMedianMustBeANumberOnNumericDataTypeValidator.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/StatisticsMedianMustBeAnIsoDateOnDateDataTypeValidator.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/StatisticsMinimumMustBeANumberOnNumericDataTypeValidator.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/StatisticsMinimumMustBeAnIsoDateOnDateDataTypeValidator.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/StatisticsThirdQuartileMustBeANumberOnNumericDataTypeValidator.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/StatisticsThirdQuartileMustBeAnIsoDateOnDateDataTypeValidator.java + + StatisticsFirstQuartileMustBeANumberOnNumericDataType constraintAnnotation) {} + + /* + * (non-Javadoc) + * + * @see javax.validation.ConstraintValidator#isValid(java.lang.Object, + * javax.validation.ConstraintValidatorContext) + */ + @Override + public boolean isValid(Variable variable, ConstraintValidatorContext context) { + + if (variable == null || variable.getDataType() == null || variable.getDistribution() == null + || variable.getDistribution().getStatistics() == null + || variable.getDistribution().getStatistics().getFirstQuartile() == null +===================================================================== +Found a 26 line (61 tokens) duplication in the following files: +Starting at line 56 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 47 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionImageResourceTest.java +Starting at line 55 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 54 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResponseRateImageResourceTest.java + + @Autowired + private ElasticsearchUpdateQueueItemRepository elasticsearchUpdateQueueItemRepository; + + @Autowired + private ElasticsearchAdminService elasticsearchAdminService; + + @Autowired + private JaversService javersService; + + @Autowired + private GridFsOperations gridFsOperations; + + @Autowired + private GridFsMetadataUpdateService gridFsMetadataUpdateService; + + private MockMvc mockMvc; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac) + .build(); + } + + @After + public void cleanUp() { + this.dataSetRepository.deleteAll(); +===================================================================== +Found a 10 line (61 tokens) duplication in the following files: +Starting at line 233 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 253 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java + + dataSetAttachmentMetadata.setLanguage("test"); + MockMultipartFile metadata = new MockMultipartFile("dataSetAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(dataSetAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/data-sets/attachments") + .file(attachment) + .file(metadata)) + .andExpect(status().isBadRequest()) + .andExpect(jsonPath("$.errors[0].message", + is("data-set-management.error.data-set-attachment-metadata.language.not-supported"))); +===================================================================== +Found a 8 line (61 tokens) duplication in the following files: +Starting at line 172 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 100 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + + public void testUpdateProject() throws IOException, Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + + // create the project with the given id + mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isCreated()); + project.setVersion(0L); +===================================================================== +Found a 10 line (61 tokens) duplication in the following files: +Starting at line 213 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 233 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + surveyAttachmentMetadata.setLanguage("test"); + MockMultipartFile metadata = new MockMultipartFile("surveyAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(surveyAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/surveys/attachments") + .file(attachment) + .file(metadata)) + .andExpect(status().isBadRequest()) + .andExpect(jsonPath("$.errors[0].message", + is("survey-management.error.survey-attachment-metadata.language.not-supported"))); +===================================================================== +Found a 11 line (61 tokens) duplication in the following files: +Starting at line 20 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/domain/QDaraUpdateQueueItem.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSubDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySubDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSubDocument.java +Starting at line 20 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/domain/QElasticsearchIndicesVersion.java + + public static final QDaraUpdateQueueItem daraUpdateQueueItem = new QDaraUpdateQueueItem("daraUpdateQueueItem"); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractRdcDomainObject _super = new eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractRdcDomainObject(this); + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + public final StringPath id = createString("id"); +===================================================================== +Found a 16 line (60 tokens) duplication in the following files: +Starting at line 170 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetManagementService.java +Starting at line 156 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/VariableManagementService.java + + ElasticsearchType.data_sets); + + } + + /** + * Enqueue update of dataSet search documents when the concept is changed. + * + * @param concept the updated, created or deleted concept. + */ + @HandleAfterCreate + @HandleAfterSave + @HandleAfterDelete + public void onConceptChanged(Concept concept) { + elasticsearchUpdateQueueService.enqueueUpsertsAsync(() -> { + Set questionIds = questionRepository.streamIdsByConceptIdsContaining(concept.getId()) + .map(question -> question.getId()).collect(Collectors.toSet()); +===================================================================== +Found a 9 line (60 tokens) duplication in the following files: +Starting at line 59 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/DataPackageSearchDocument.java +Starting at line 46 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/VariableSearchDocument.java + + private List nestedQuestions = new ArrayList<>(); + + private List instruments = new ArrayList<>(); + private List nestedInstruments = new ArrayList<>(); + + private List concepts = new ArrayList<>(); + private List nestedConcepts = new ArrayList<>(); + + private List nestedInstitutions = new ArrayList<>(); +===================================================================== +Found a 7 line (60 tokens) duplication in the following files: +Starting at line 86 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 126 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 153 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 68 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java + + public void testCreateConcept() throws IOException, Exception { + Concept concept = UnitTestCreateDomainObjectUtils.buildConcept(); + + // create the concept with the given id + mockMvc.perform(put(API_CONCEPT_URI + "/" + concept.getId()) + .content(TestUtil.convertObjectToJsonBytes(concept)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); +===================================================================== +Found a 6 line (60 tokens) duplication in the following files: +Starting at line 130 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageShadowCopyServiceTest.java +Starting at line 137 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetShadowCopyServiceTest.java +Starting at line 130 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentShadowCopyServiceTest.java +Starting at line 121 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/service/DataAcquisitionProjectShadowCopyServiceTest.java +Starting at line 138 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionShadowCopyServiceTest.java +Starting at line 134 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyShadowCopyServiceTest.java +Starting at line 131 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/VariableShadowCopyServiceTest.java + + Optional successor = + result.stream().filter(s -> s.getId().equals(successorId)).findFirst(); + assertThat(successor.isPresent(), equalTo(true)); + assertThat(successor.get().getSuccessorId(), equalTo(null)); + + Optional predecessor = +===================================================================== +Found a 6 line (60 tokens) duplication in the following files: +Starting at line 86 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 154 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 172 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java + + public void testCreateDataAcquisitionProject() throws IOException, Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + // create the project with the given id + mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isCreated()); +===================================================================== +Found a 9 line (60 tokens) duplication in the following files: +Starting at line 159 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 186 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 214 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java + + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isCreated()); + + // load the project with the projection + mockMvc + .perform( + get(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()).andExpect(jsonPath("$.id", is(project.getId()))) + .andExpect(jsonPath("$.version", is(0))); +===================================================================== +Found a 7 line (60 tokens) duplication in the following files: +Starting at line 149 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResourceTest.java +Starting at line 172 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResourceTest.java + + post(API_DATA_ACQUISITION_PROJECTS_URI + "/" + projectId + "/shadows/1.0.0/hidden")) + .andExpect(status().isAccepted()); + + // check if hiding is in progress + this.mockMvc + .perform(get(API_DATA_ACQUISITION_PROJECTS_URI + "/" + projectId + "/shadows/1.0.0/action")) + .andExpect(status().isOk()).andExpect(jsonPath("$.action", is(Action.HIDE.name()))); +===================================================================== +Found a 11 line (60 tokens) duplication in the following files: +Starting at line 78 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/service/UserServiceTest.java +Starting at line 115 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/service/UserServiceTest.java + + .minusHours(25); + String resetKey = RandomUtil.generateResetKey(); + user.setActivated(true); + user.setResetDate(daysAgo); + user.setResetKey(resetKey); + + userRepository.save(user); + + Optional maybeUser = userService.completePasswordReset("johndoe2", user.getResetKey()); + + assertThat(maybeUser.isPresent()).isFalse(); +===================================================================== +Found a 10 line (60 tokens) duplication in the following files: +Starting at line 180 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 198 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 216 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 234 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 260 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 288 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 318 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 346 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 451 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 469 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 486 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 504 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 543 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 676 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 696 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 716 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 736 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 756 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 776 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 823 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 842 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + public void testCreateVariableWithoutScaleLevel() throws Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + List surveyNumbers = new ArrayList<>(); + surveyNumbers.add(1); + + Variable variable = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "var1", 1, surveyNumbers); + variable.setScaleLevel(null); +===================================================================== +Found a 22 line (59 tokens) duplication in the following files: +Starting at line 47 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAccessWaysResourceControllerTest.java +Starting at line 45 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java + + @Autowired + private SurveyRepository surveyRepository; + + @Autowired + private ElasticsearchUpdateQueueItemRepository elasticsearchUpdateQueueItemRepository; + + @Autowired + private ElasticsearchAdminService elasticsearchAdminService; + + @Autowired + private JaversService javersService; + + private MockMvc mockMvc; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac).build(); + } + + @After + public void cleanUp() { + dataAcquisitionProjectRepository.deleteAll(); +===================================================================== +Found a 20 line (59 tokens) duplication in the following files: +Starting at line 50 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAccessWaysResourceControllerTest.java +Starting at line 49 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java + + @Autowired + private ElasticsearchUpdateQueueItemRepository elasticsearchUpdateQueueItemRepository; + + @Autowired + private ElasticsearchAdminService elasticsearchAdminService; + + @Autowired + private JaversService javersService; + + private MockMvc mockMvc; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac).build(); + } + + @After + public void cleanUp() { + dataAcquisitionProjectRepository.deleteAll(); + dataSetRepository.deleteAll(); +===================================================================== +Found a 8 line (59 tokens) duplication in the following files: +Starting at line 237 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 256 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 308 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java + + dataPackageAttachmentMetadata.setType(new I18nString("hurz", "hurz")); + MockMultipartFile metadata = new MockMultipartFile("dataPackageAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(dataPackageAttachmentMetadata)); + + mockMvc + .perform(MockMvcRequestBuilders.multipart("/api/data-packages/attachments").file(attachment) + .file(metadata)) + .andExpect(status().isBadRequest()).andExpect(jsonPath("$.errors[0].message", +===================================================================== +Found a 9 line (59 tokens) duplication in the following files: +Starting at line 233 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 253 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 310 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java + + dataSetAttachmentMetadata.setLanguage("test"); + MockMultipartFile metadata = new MockMultipartFile("dataSetAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(dataSetAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/data-sets/attachments") + .file(attachment) + .file(metadata)) + .andExpect(status().isBadRequest()) + .andExpect(jsonPath("$.errors[0].message", +===================================================================== +Found a 13 line (59 tokens) duplication in the following files: +Starting at line 93 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 127 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 277 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java + + public void testCreateDataSet() throws Exception { + + // Arrange + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + this.dataAcquisitionProjectRepository.save(project); + + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); + + DataSet dataSet = UnitTestCreateDomainObjectUtils.buildDataSet(project.getId(), survey.getId(), 1); + + // Act and Assert + // create the variable with the given id + mockMvc.perform(put(API_DATASETS_URI + "/" + dataSet.getId()) +===================================================================== +Found a 7 line (59 tokens) duplication in the following files: +Starting at line 76 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java +Starting at line 100 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java + + public void testCreateDataSetAndReadVersions() throws IOException, Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); + DataSet dataSet = UnitTestCreateDomainObjectUtils.buildDataSet(project.getId(), survey.getId(), + survey.getNumber()); +===================================================================== +Found a 7 line (59 tokens) duplication in the following files: +Starting at line 68 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/ordermanagement/rest/OrderResourceTest.java +Starting at line 85 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/ordermanagement/rest/OrderResourceTest.java + + order.getProducts().add(createProduct(order.getId())); + + mockMvc + .perform(put(UPDATE_ORDER_URL + order.getId()).contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(order))) + .andExpect(status().isOk()).andExpect(header().exists("Location")) + .andExpect(jsonPath("$.id", equalTo(order.getId()))) +===================================================================== +Found a 9 line (59 tokens) duplication in the following files: +Starting at line 213 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 233 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 289 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + surveyAttachmentMetadata.setLanguage("test"); + MockMultipartFile metadata = new MockMultipartFile("surveyAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(surveyAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/surveys/attachments") + .file(attachment) + .file(metadata)) + .andExpect(status().isBadRequest()) + .andExpect(jsonPath("$.errors[0].message", +===================================================================== +Found a 7 line (59 tokens) duplication in the following files: +Starting at line 337 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 359 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + .andExpect(status().isCreated()); + + // get the survey and check the updated title and version + mockMvc.perform(get(API_SURVEYS_URI + "/" + survey.getId())) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.id", is(survey.getId()))) + .andExpect(jsonPath("$.version", is(0))) +===================================================================== +Found a 10 line (59 tokens) duplication in the following files: +Starting at line 180 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 608 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + public void testCreateVariableWithoutScaleLevel() throws Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + List surveyNumbers = new ArrayList<>(); + surveyNumbers.add(1); + + Variable variable = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "var1", 1, surveyNumbers); + variable.setScaleLevel(null); +===================================================================== +Found a 13 line (59 tokens) duplication in the following files: +Starting at line 46 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java +Starting at line 41 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSubDocument.java +Starting at line 41 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySubDocument.java +Starting at line 48 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QSurvey.java + + public final StringPath id = createString("id"); + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + public final StringPath masterId = createString("masterId"); + + public final NumberPath number = createNumber("number", Integer.class); + + public final ListPath originalLanguages = this.createList("originalLanguages", String.class, StringPath.class, PathInits.DIRECT2); +===================================================================== +Found a 10 line (59 tokens) duplication in the following files: +Starting at line 57 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 72 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java + + public final ListPath instruments = this.createList("instruments", InstrumentSubDocument.class, QInstrumentSubDocument.class, PathInits.DIRECT2); + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + //inherited + public final StringPath license = _super.license; +===================================================================== +Found a 10 line (59 tokens) duplication in the following files: +Starting at line 47 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetNestedDocument.java +Starting at line 47 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentNestedDocument.java +Starting at line 49 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableNestedDocument.java +Starting at line 55 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSubDocument.java + + public final StringPath masterId = createString("masterId"); + + public final BooleanPath shadow = createBoolean("shadow"); + + public final StringPath successorId = createString("successorId"); + + public final ListPath surveyIds = this.createList("surveyIds", String.class, StringPath.class, PathInits.DIRECT2); + + //inherited + public final NumberPath version; +===================================================================== +Found a 10 line (59 tokens) duplication in the following files: +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java + + public final eu.dzhw.fdz.metadatamanagement.instrumentmanagement.domain.QInstrument _super = new eu.dzhw.fdz.metadatamanagement.instrumentmanagement.domain.QInstrument(this); + + // custom + // inherited + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(_super.annotations); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString completeTitle; + + //inherited + public final ListPath conceptIds = _super.conceptIds; +===================================================================== +Found a 10 line (58 tokens) duplication in the following files: +Starting at line 358 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 445 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 552 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 600 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java + + dataSets, concepts, release, doi, configuration); + + request.add(new IndexRequest(lockedItem.getDocumentType().name()).id(searchDocument.getId()) + .source(gson.toJson(searchDocument), XContentType.JSON)); + return true; + } + return false; + } + + private boolean addUpsertActionForRelatedPublication(ElasticsearchUpdateQueueItem lockedItem, +===================================================================== +Found a 10 line (58 tokens) duplication in the following files: +Starting at line 73 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 83 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 84 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 83 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + this.javersService.deleteAll(); + this.gridFsOperations.delete(new Query()); + } + + @Test + @WithMockUser(authorities=AuthoritiesConstants.PUBLISHER, username="test") + public void testUploadValidAttachment() throws Exception { + + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); +===================================================================== +Found a 7 line (58 tokens) duplication in the following files: +Starting at line 96 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 119 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java + + mockMvc.perform(put(API_DATAPACKAGE_URI + "/" + dataPackage.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataPackage)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); + + // read the dataPackage under the new url + mockMvc.perform(get(API_DATAPACKAGE_URI + "/" + dataPackage.getId())) + .andExpect(status().isOk()); +===================================================================== +Found a 7 line (58 tokens) duplication in the following files: +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 106 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java + + mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isCreated()); + + // read the project under the new url + mockMvc.perform(get(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId())) + .andExpect(status().isOk()); +===================================================================== +Found a 6 line (58 tokens) duplication in the following files: +Starting at line 78 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 100 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + + public void testCreateProjectAndReadVersions() throws Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + // create the dataPackage with the given id + mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isCreated()); +===================================================================== +Found a 7 line (58 tokens) duplication in the following files: +Starting at line 93 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 118 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 335 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + mockMvc.perform(put(API_SURVEYS_URI + "/" + survey.getId()) + .content(TestUtil.convertObjectToJsonBytes(survey)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); + + // read the survey under the new url + mockMvc.perform(get(API_SURVEYS_URI + "/" + survey.getId())) + .andExpect(status().isOk()); +===================================================================== +Found a 8 line (58 tokens) duplication in the following files: +Starting at line 172 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 210 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 229 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + .minusDays(1)) + .build()) + .build(); + + // create the survey with the given id but with wrong period + mockMvc.perform(put(API_SURVEYS_URI + "/" + survey.getId()) + .content(TestUtil.convertObjectToJsonBytes(survey)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) +===================================================================== +Found a 7 line (58 tokens) duplication in the following files: +Starting at line 261 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 278 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + + "\"fieldPeriod\":{\"start\":\"2012-12-01\",\"end\":\"2013-04-01\"}}"; + + // create the survey with the given id but without a project + mockMvc.perform(put(API_SURVEYS_URI + "/6").content(survey).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) + .andExpect(jsonPath("$.errors[0].invalidValue", is("6te"))) + .andExpect(jsonPath("$.errors[0].property", is("sampleSize"))) +===================================================================== +Found a 4 line (58 tokens) duplication in the following files: +Starting at line 157 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/UserResourceTest.java +Starting at line 164 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/UserResourceTest.java + + restUserMockMvc + .perform(get("/api//users/findUserWithRole/").param("login", login).param("role", role) + .contentType(TestUtil.APPLICATION_JSON_UTF8).accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()).andExpect(jsonPath("$.[0].login").value("user")); +===================================================================== +Found a 9 line (58 tokens) duplication in the following files: +Starting at line 103 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 135 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 180 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 198 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 216 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 234 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 260 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 288 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 318 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 346 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 368 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 397 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 429 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 451 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 469 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 486 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 504 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 543 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 676 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 696 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 716 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 736 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 756 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 776 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 797 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 823 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 842 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + public void testCreateVariable() throws Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + List surveyNumbers = new ArrayList<>(); + surveyNumbers.add(1); + + Variable variable = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "var1", 1, surveyNumbers); +===================================================================== +Found a 8 line (58 tokens) duplication in the following files: +Starting at line 562 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 581 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + public void testCreateVariableWithInvalidId() throws Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + List surveyNumbers = new ArrayList<>(); + surveyNumbers.add(1); + Variable variable = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "var", 1, surveyNumbers); +===================================================================== +Found a 14 line (58 tokens) duplication in the following files: +Starting at line 28 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QDataSet.java +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSubDocument.java +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSubDocument.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("annotations")); + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + public final StringPath dataAcquisitionProjectId = createString("dataAcquisitionProjectId"); + + public final StringPath dataPackageId = createString("dataPackageId"); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString description = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("description")); +===================================================================== +Found a 14 line (58 tokens) duplication in the following files: +Starting at line 58 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/domain/QQuestion.java +Starting at line 43 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSubDocument.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString introduction = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("introduction")); + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + public final StringPath masterId = createString("masterId"); + + public final StringPath number = createString("number"); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString questionText = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("questionText")); +===================================================================== +Found a 12 line (58 tokens) duplication in the following files: +Starting at line 45 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveyNestedDocument.java +Starting at line 57 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySubDocument.java + + public final StringPath masterId = createString("masterId"); + + public final BooleanPath shadow = createBoolean("shadow"); + + public final StringPath successorId = createString("successorId"); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString surveyMethod; + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString title; + + //inherited + public final NumberPath version; +===================================================================== +Found a 13 line (58 tokens) duplication in the following files: +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySubDocument.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QSurvey.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractRdcDomainObject _super = new eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractRdcDomainObject(this); + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + public final StringPath dataAcquisitionProjectId = createString("dataAcquisitionProjectId"); + + public final StringPath dataPackageId = createString("dataPackageId"); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString dataType; +===================================================================== +Found a 6 line (57 tokens) duplication in the following files: +Starting at line 99 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptManagementService.java +Starting at line 144 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptManagementService.java +Starting at line 186 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptManagementService.java +Starting at line 210 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptManagementService.java + + conceptIds.addAll(questionRepository.findSubDocumentsByInstrumentIdIn(instrumentIds).stream() + .map(question -> question.getConceptIds() != null ? question.getConceptIds() + : new ArrayList()) + .flatMap(List::stream).collect(Collectors.toSet())); + return conceptRepository.streamIdsByIdIn(conceptIds); + } +===================================================================== +Found a 7 line (57 tokens) duplication in the following files: +Starting at line 41 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/helper/DataSetShadowCopyDataSource.java +Starting at line 42 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/helper/InstrumentShadowCopyDataSource.java +Starting at line 42 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/helper/QuestionShadowCopyDataSource.java + + DataSet copy = crudHelper.read(derivedId).orElseGet(DataSet::new); + BeanUtils.copyProperties(source, copy, "version"); + copy.setId(derivedId); + copy.setDataAcquisitionProjectId( + source.getDataAcquisitionProjectId() + "-" + release.getVersion()); + copy.setDataPackageId(source.getDataPackageId() + "-" + release.getVersion()); + copy.setSurveyIds(createDerivedSurveyIds(source.getSurveyIds(), release.getVersion())); +===================================================================== +Found a 10 line (57 tokens) duplication in the following files: +Starting at line 358 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 482 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 600 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java + + dataSets, concepts, release, doi, configuration); + + request.add(new IndexRequest(lockedItem.getDocumentType().name()).id(searchDocument.getId()) + .source(gson.toJson(searchDocument), XContentType.JSON)); + return true; + } + return false; + } + + private boolean addUpsertActionForRelatedPublication(ElasticsearchUpdateQueueItem lockedItem, +===================================================================== +Found a 6 line (57 tokens) duplication in the following files: +Starting at line 118 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 196 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 93 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 190 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 221 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 79 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java + + DataPackage dataPackage = UnitTestCreateDomainObjectUtils.buildDataPackage(project.getId()); + + // create the dataPackage with the given id + mockMvc.perform(put(API_DATAPACKAGE_URI + "/" + dataPackage.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataPackage)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); +===================================================================== +Found a 10 line (57 tokens) duplication in the following files: +Starting at line 84 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 160 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java + + .file(attachment).file(metadata)).andExpect(status().isCreated()); + + // read the created attachment and check the version + mockMvc + .perform(get( + "/api/instruments/" + instrumentAttachmentMetadata.getInstrumentId() + "/attachments")) + .andExpect(status().isOk()) + .andExpect( + jsonPath("$.[0].instrumentId", is(instrumentAttachmentMetadata.getInstrumentId()))) + .andExpect(jsonPath("$.[0].version", is(0))) +===================================================================== +Found a 7 line (57 tokens) duplication in the following files: +Starting at line 67 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/ordermanagement/rest/OrderResourceTest.java +Starting at line 127 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/ordermanagement/rest/OrderResourceTest.java + + order = orderRepository.findAll().get(0); + order.getProducts().add(createProduct(order.getId())); + + mockMvc + .perform(put(UPDATE_ORDER_URL + order.getId()).contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(order))) + .andExpect(status().isOk()).andExpect(header().exists("Location")) +===================================================================== +Found a 9 line (57 tokens) duplication in the following files: +Starting at line 148 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 168 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 188 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java + + UnitTestCreateDomainObjectUtils.buildRelatedPublication(null, 2017); + + // ACT + this.mockMvc + .perform(put(API_RELATED_PUBLICATION_URI + "/" + relatedPublication.getId()) + .content(TestUtil.convertObjectToJsonBytes(relatedPublication)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) + .andExpect(jsonPath("$.errors[0].message", containsString( +===================================================================== +Found a 10 line (57 tokens) duplication in the following files: +Starting at line 198 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 216 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 234 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 260 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 288 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 318 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 346 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 469 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 486 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 504 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 543 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 608 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 676 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 696 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 716 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 736 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 756 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 776 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 823 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 842 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + public void testCreateVariableWithWrongRepeatedMeasurementIdentifier() throws Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + List surveyNumbers = new ArrayList<>(); + surveyNumbers.add(1); + + Variable variable = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "var1", 1, surveyNumbers); + variable.setRepeatedMeasurementIdentifier("WrongIdentifier"); +===================================================================== +Found a 11 line (57 tokens) duplication in the following files: +Starting at line 36 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 38 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java + + public final ListPath dataCurators = this.createList("dataCurators", eu.dzhw.fdz.metadatamanagement.common.domain.Person.class, eu.dzhw.fdz.metadatamanagement.common.domain.QPerson.class, PathInits.DIRECT2); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString description = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("description")); + + //inherited + public final BooleanPath hidden = _super.hidden; + + public final StringPath id = createString("id"); + + public final ListPath institutions = this.createList("institutions", eu.dzhw.fdz.metadatamanagement.common.domain.I18nString.class, eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString.class, PathInits.DIRECT2); +===================================================================== +Found a 14 line (57 tokens) duplication in the following files: +Starting at line 28 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QDataSet.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSubDocument.java +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSubDocument.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySubDocument.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QSurvey.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("annotations")); + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + public final StringPath dataAcquisitionProjectId = createString("dataAcquisitionProjectId"); + + public final StringPath dataPackageId = createString("dataPackageId"); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString description = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("description")); +===================================================================== +Found a 9 line (57 tokens) duplication in the following files: +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 29 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java + + public final ListPath accessWays = this.createList("accessWays", String.class, StringPath.class, PathInits.DIRECT2); + + // custom + // inherited + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(_super.annotations); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString completeTitle; + + public final ListPath concepts = this.createList("concepts", ConceptSubDocument.class, QConceptSubDocument.class, PathInits.DIRECT2); +===================================================================== +Found a 5 line (57 tokens) duplication in the following files: +Starting at line 63 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSubDocument.java +Starting at line 57 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSubDocument.java + + public final StringPath successorId = createString("successorId"); + + public final ListPath surveyIds = this.createList("surveyIds", String.class, StringPath.class, PathInits.DIRECT2); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString type; +===================================================================== +Found a 17 line (57 tokens) duplication in the following files: +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionNestedDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveyNestedDocument.java + + public static final QQuestionNestedDocument questionNestedDocument = new QQuestionNestedDocument("questionNestedDocument"); + + public final QAbstractNestedSubDocument _super; + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString completeTitle; + + //inherited + public final StringPath createdBy; + + //inherited + public final DateTimePath createdDate; + + public final StringPath dataPackageId = createString("dataPackageId"); + + public final StringPath id = createString("id"); + + public final StringPath instrumentId = createString("instrumentId"); +===================================================================== +Found a 12 line (56 tokens) duplication in the following files: +Starting at line 49 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/helper/DataPackageShadowCopyDataSource.java +Starting at line 52 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/helper/DataSetShadowCopyDataSource.java +Starting at line 53 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/helper/InstrumentShadowCopyDataSource.java +Starting at line 44 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/service/helper/DataAcquisitionProjectShadowCopyDataSource.java +Starting at line 54 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/helper/QuestionShadowCopyDataSource.java +Starting at line 50 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/helper/SurveyShadowCopyDataSource.java +Starting at line 85 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/helper/VariableShadowCopyDataSource.java + + public Optional findPredecessorOfShadowCopy(DataPackage shadowCopy, + String previousVersion) { + String shadowCopyId = shadowCopy.getMasterId() + "-" + previousVersion; + if (shadowCopy.getId().equals(shadowCopyId)) { + return Optional.empty(); + } else { + return crudHelper.read(shadowCopyId); + } + } + + @Override + public void updatePredecessor(DataPackage predecessor) { +===================================================================== +Found a 13 line (56 tokens) duplication in the following files: +Starting at line 252 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java +Starting at line 280 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java + + String subject = messageSource.getMessage("email.assignee-group-changed.title", + new Object[] {projectId}, locale); + sendEmail(sender, new String[] {user.getEmail()}, null, + currentUser != null ? currentUser.getEmail() : null, subject, content, false, true); + }); + } + + /** + * Send a mail to data providers informing them that they've been removed as the assignee group by + * a publisher. + */ + @Async + public void sendDataProviderAccessRevokedMail(List users, String projectId, String message, +===================================================================== +Found a 8 line (56 tokens) duplication in the following files: +Starting at line 358 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 445 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 482 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 552 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 600 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 645 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java + + dataSets, concepts, release, doi, configuration); + + request.add(new IndexRequest(lockedItem.getDocumentType().name()).id(searchDocument.getId()) + .source(gson.toJson(searchDocument), XContentType.JSON)); + return true; + } + return false; + } +===================================================================== +Found a 12 line (56 tokens) duplication in the following files: +Starting at line 266 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 63 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentVersionsResourceTest.java + + .buildConceptAttachmentMetadata(concept.getId()); + + MockMultipartFile metadata = new MockMultipartFile("conceptAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(conceptAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/concepts/attachments") + .file(attachment) + .file(metadata)) + .andExpect(status().isCreated()); + + // delete the concept by id + mockMvc.perform(delete("/api/concepts/" + concept.getId())) +===================================================================== +Found a 22 line (56 tokens) duplication in the following files: +Starting at line 59 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 59 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 50 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionImageResourceTest.java +Starting at line 58 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 57 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResponseRateImageResourceTest.java + + @Autowired + private ElasticsearchAdminService elasticsearchAdminService; + + @Autowired + private JaversService javersService; + + @Autowired + private GridFsOperations gridFsOperations; + + @Autowired + private GridFsMetadataUpdateService gridFsMetadataUpdateService; + + private MockMvc mockMvc; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac).build(); + } + + @After + public void cleanUp() { + this.dataPackageRepository.deleteAll(); +===================================================================== +Found a 10 line (56 tokens) duplication in the following files: +Starting at line 281 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 63 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentVersionsResourceTest.java + + .buildDataPackageAttachmentMetadata(dataPackage.getDataAcquisitionProjectId()); + + MockMultipartFile metadata = new MockMultipartFile("dataPackageAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(dataPackageAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/data-packages/attachments") + .file(attachment).file(metadata)).andExpect(status().isCreated()); + + // delete the dataPackage by project id + mockMvc.perform(delete("/api/data-packages/" + dataPackage.getId())) +===================================================================== +Found a 22 line (56 tokens) duplication in the following files: +Starting at line 37 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/AvailableDataSetNumbersResourceControllerTest.java +Starting at line 32 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/AvailableSurveyNumbersResourceControllerTest.java + + @Autowired + private SurveyRepository surveyRepo; + + @Autowired + private DataAcquisitionProjectRepository rdcProjectRepository; + + @Autowired + private ElasticsearchUpdateQueueItemRepository elasticsearchUpdateQueueItemRepository; + + @Autowired + private ElasticsearchAdminService elasticsearchAdminService; + + @Autowired + private JaversService javersService; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac).build(); + } + + @After + public void cleanUp() { +===================================================================== +Found a 12 line (56 tokens) duplication in the following files: +Starting at line 281 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 63 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentVersionsResourceTest.java + + .buildDataSetAttachmentMetadata(dataSet.getDataAcquisitionProjectId(), dataSet.getNumber()); + + MockMultipartFile metadata = new MockMultipartFile("dataSetAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(dataSetAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/data-sets/attachments") + .file(attachment) + .file(metadata)) + .andExpect(status().isCreated()); + + // delete the dataSet with the given id + mockMvc.perform(delete("/api/data-sets/" + dataSet.getId())) +===================================================================== +Found a 5 line (56 tokens) duplication in the following files: +Starting at line 110 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 144 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 104 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 137 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 108 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 139 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 124 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 155 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + mockMvc.perform(get(API_DATASETS_URI + "/" + dataSet.getId())) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.createdDate", not(isEmptyOrNullString()))) + .andExpect(jsonPath("$.lastModifiedDate", not(isEmptyOrNullString()))) + .andExpect(jsonPath("$.createdBy", is("user"))) +===================================================================== +Found a 14 line (56 tokens) duplication in the following files: +Starting at line 127 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 248 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java + + public void testCreateDataSetWithPost() throws Exception { + + // Arrange + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + this.dataAcquisitionProjectRepository.save(project); + + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); + + DataSet dataSet = + UnitTestCreateDomainObjectUtils.buildDataSet(project.getId(), survey.getId(), 1); + + // Act and Assert + // create the variable with the given id + mockMvc.perform(post(API_DATASETS_URI).content(TestUtil.convertObjectToJsonBytes(dataSet)) +===================================================================== +Found a 10 line (56 tokens) duplication in the following files: +Starting at line 79 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 105 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 137 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 181 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 261 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 63 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentVersionsResourceTest.java + + UnitTestCreateDomainObjectUtils.buildInstrumentAttachmentMetadata("projectid", 1); + MockMultipartFile metadata = new MockMultipartFile("instrumentAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(instrumentAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/instruments/attachments") + .file(attachment).file(metadata)).andExpect(status().isCreated()); + + // read the created attachment and check the version + mockMvc + .perform(get( +===================================================================== +Found a 10 line (56 tokens) duplication in the following files: +Starting at line 386 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 422 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 439 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java + + rdcProjectRepository.save(project); + + mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .content(TestUtil.convertObjectToJsonBytes(project)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isNoContent()); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER, username = PUBLISHER_USERNAME) +===================================================================== +Found a 10 line (56 tokens) duplication in the following files: +Starting at line 407 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 456 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java + + project.getConfiguration().getRequirements().setDataSetsRequired(true); + + mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .content(TestUtil.convertObjectToJsonBytes(project)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.DATA_PROVIDER, username = DATA_PROVIDER_USERNAME) +===================================================================== +Found a 11 line (56 tokens) duplication in the following files: +Starting at line 93 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 120 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 147 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 174 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 260 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 63 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentVersionsResourceTest.java + + .buildSurveyAttachmentMetadata("projectid", 1); + MockMultipartFile metadata = new MockMultipartFile("surveyAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(surveyAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/surveys/attachments") + .file(attachment) + .file(metadata)) + .andExpect(status().isCreated()); + + // read the created attachment and check the version + mockMvc.perform( +===================================================================== +Found a 5 line (56 tokens) duplication in the following files: +Starting at line 163 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/UserResourceTest.java +Starting at line 170 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/UserResourceTest.java + + role = AuthoritiesConstants.ADMIN; + restUserMockMvc + .perform(get("/api//users/findUserWithRole/").param("login", login).param("role", role) + .contentType(TestUtil.APPLICATION_JSON_UTF8).accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()).andExpect(jsonPath("$.[0].login").value("admin")); +===================================================================== +Found a 14 line (56 tokens) duplication in the following files: +Starting at line 31 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/domain/QQuestion.java +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSubDocument.java +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSubDocument.java + + public final ListPath conceptIds = this.createList("conceptIds", String.class, StringPath.class, PathInits.DIRECT2); + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + public final StringPath dataAcquisitionProjectId = createString("dataAcquisitionProjectId"); + + public final StringPath dataPackageId = createString("dataPackageId"); + + //inherited + public final BooleanPath hidden = _super.hidden; +===================================================================== +Found a 6 line (56 tokens) duplication in the following files: +Starting at line 29 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 33 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 32 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(_super.annotations); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString completeTitle; + + //inherited + public final ListPath conceptIds = _super.conceptIds; +===================================================================== +Found a 7 line (55 tokens) duplication in the following files: +Starting at line 145 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageOverviewService.java +Starting at line 227 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetReportService.java + + private List validateDataPackageOverviewStructure(FileSystem zipFileSystem) { + List missingTexFiles = new ArrayList<>(); + + Path mainFile = zipFileSystem.getPath(zipFileSystem.getPath("/").toString(), KEY_MAIN); + if (!Files.exists(mainFile)) { + missingTexFiles.add(KEY_MAIN); + } +===================================================================== +Found a 6 line (55 tokens) duplication in the following files: +Starting at line 41 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/helper/DataSetShadowCopyDataSource.java +Starting at line 42 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/helper/InstrumentShadowCopyDataSource.java +Starting at line 42 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/helper/QuestionShadowCopyDataSource.java +Starting at line 40 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/helper/SurveyShadowCopyDataSource.java + + DataSet copy = crudHelper.read(derivedId).orElseGet(DataSet::new); + BeanUtils.copyProperties(source, copy, "version"); + copy.setId(derivedId); + copy.setDataAcquisitionProjectId( + source.getDataAcquisitionProjectId() + "-" + release.getVersion()); + copy.setDataPackageId(source.getDataPackageId() + "-" + release.getVersion()); +===================================================================== +Found a 7 line (55 tokens) duplication in the following files: +Starting at line 45 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/DataPackageSearchDocument.java +Starting at line 41 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/SurveySearchDocument.java + + private List dataSets = new ArrayList<>(); + private List nestedDataSets = new ArrayList<>(); + + private List variables = new ArrayList<>(); + private List nestedVariables = new ArrayList<>(); + + private List relatedPublications = new ArrayList<>(); +===================================================================== +Found a 5 line (55 tokens) duplication in the following files: +Starting at line 329 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 421 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 534 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java + + questionRepository.findSubDocumentsByInstrumentId(instrument.getId()); + Set conceptIds = questions.stream() + .map(question -> question.getConceptIds() != null ? question.getConceptIds() + : new ArrayList()) + .flatMap(List::stream).collect(Collectors.toSet()); +===================================================================== +Found a 7 line (55 tokens) duplication in the following files: +Starting at line 340 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 578 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java + + variableRepository.findSubDocumentsByRelatedQuestionsInstrumentId(instrument.getId()); + Set dataSetIds = + variables.stream().map(variable -> variable.getDataSetId()).collect(Collectors.toSet()); + List dataSets = + dataSetRepository.findSubDocumentsByIdIn(dataSetIds); + DataAcquisitionProject project = + projectRepository.findById(instrument.getDataAcquisitionProjectId()).orElse(null); +===================================================================== +Found a 10 line (55 tokens) duplication in the following files: +Starting at line 101 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 212 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java + + dataPackageAttachmentMetadata.generateId(); + + // read the created attachment and check the version + mockMvc + .perform(get("/api/data-packages/" + + dataPackageAttachmentMetadata.getDataPackageId() + "/attachments")) + .andExpect(status().isOk()) + .andExpect( + jsonPath("$.[0].dataPackageId", is(dataPackageAttachmentMetadata.getDataPackageId()))) + .andExpect(jsonPath("$.[0].version", is(0))) +===================================================================== +Found a 9 line (55 tokens) duplication in the following files: +Starting at line 135 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 257 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 272 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java + + dataPackage.setHidden(true); + + // create the hidden dataPackage with the given id + mockMvc + .perform(put(API_DATAPACKAGE_URI + "/" + dataPackage.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataPackage)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) + .andExpect(jsonPath("$.errors[0].message", containsString("invalid-hidden-shadow"))); +===================================================================== +Found a 8 line (55 tokens) duplication in the following files: +Starting at line 205 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 228 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 250 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java + + instrument.setType("HURZ"); + + // update the instrument with the given id + mockMvc.perform(put(API_INSTRUMENTS_URI + "/" + instrument.getId()) + .content(TestUtil.convertObjectToJsonBytes(instrument)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) + .andExpect( + jsonPath("$.errors[0].message", is("instrument-management.error.instrument.type.valid"))); +===================================================================== +Found a 6 line (55 tokens) duplication in the following files: +Starting at line 86 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 154 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 100 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + + public void testCreateDataAcquisitionProject() throws IOException, Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + // create the project with the given id + mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isCreated()); +===================================================================== +Found a 7 line (55 tokens) duplication in the following files: +Starting at line 172 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 78 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + + public void testUpdateProject() throws IOException, Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + + // create the project with the given id + mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isCreated()); +===================================================================== +Found a 11 line (55 tokens) duplication in the following files: +Starting at line 136 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 151 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 174 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + survey.setDataType(I18nString.builder().de("Mixed Methods").en("Mixed Methods").build()); + + // create the survey with the given id but with wrong period + mockMvc.perform(put(API_SURVEYS_URI + "/" + survey.getId()) + .content(TestUtil.convertObjectToJsonBytes(survey)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) + .andReturn(); + } + + @Test + public void testCreateSurveyWithNoDataType() throws Exception { +===================================================================== +Found a 9 line (55 tokens) duplication in the following files: +Starting at line 103 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 135 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 368 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 397 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 429 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 608 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 797 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + public void testCreateVariable() throws Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + List surveyNumbers = new ArrayList<>(); + surveyNumbers.add(1); + + Variable variable = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "var1", 1, surveyNumbers); +===================================================================== +Found a 9 line (55 tokens) duplication in the following files: +Starting at line 305 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 334 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 355 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 384 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 416 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 886 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + variable.getDistribution().getStatistics().setFirstQuartile("2017-01-30"); + + // create the variable with a survey but without a project + mockMvc + .perform(put(API_VARIABLES_URI + "/" + variable.getId()) + .content(TestUtil.convertObjectToJsonBytes(variable)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) + .andExpect(jsonPath("$.errors[0].message", containsString( +===================================================================== +Found a 14 line (55 tokens) duplication in the following files: +Starting at line 45 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionNestedDocument.java +Starting at line 49 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSubDocument.java + + public final DateTimePath lastModifiedDate; + + public final StringPath masterId = createString("masterId"); + + public final StringPath number = createString("number"); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString questionText; + + public final BooleanPath shadow = createBoolean("shadow"); + + public final StringPath successorId = createString("successorId"); + + //inherited + public final NumberPath version; +===================================================================== +Found a 11 line (54 tokens) duplication in the following files: +Starting at line 57 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentService.java +Starting at line 60 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentService.java +Starting at line 55 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentService.java +Starting at line 53 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentService.java + + DataPackageAttachmentMetadata metadata) throws IOException { + + if (metadata.isShadow()) { + throw new ShadowCopyCreateNotAllowedException(); + } + + String currentUser = SecurityUtils.getCurrentUserLogin(); + attachmentMetadataHelper.initAttachmentMetadata(metadata, currentUser); + metadata.generateId(); + metadata.setMasterId(metadata.getId()); + String filename = DataPackageAttachmentFilenameBuilder.buildFileName(metadata); +===================================================================== +Found a 8 line (54 tokens) duplication in the following files: +Starting at line 49 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageListService.java +Starting at line 91 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageListService.java + + public Page loadDataPackages(int page, int size) throws IOException { + SearchSourceBuilder sourceBuilder = new SearchSourceBuilder(); + + sourceBuilder.fetchSource(null, + ExcludeFieldsHelper.getFieldsToExcludeOnDeserialization(DataPackageSearchDocument.class)); + sourceBuilder + .query(QueryBuilders.boolQuery().filter(QueryBuilders.termQuery("shadow", true)) + .mustNot(QueryBuilders.existsQuery("successorId"))) +===================================================================== +Found a 19 line (54 tokens) duplication in the following files: +Starting at line 58 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 43 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java + + @Autowired + private ElasticsearchUpdateQueueItemRepository elasticsearchUpdateQueueItemRepository; + + @Autowired + private ElasticsearchAdminService elasticsearchAdminService; + + @Autowired + private JaversService javersService; + + private MockMvc mockMvc; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac).build(); + } + + @After + public void cleanUp() { + conceptRepository.deleteAll(); +===================================================================== +Found a 4 line (54 tokens) duplication in the following files: +Starting at line 80 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java +Starting at line 115 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java +Starting at line 137 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java + + .andExpect(jsonPath("$[0].title.de", is(concept.getTitle().getDe()))) + .andExpect(jsonPath("$[0].authors.length()", is(equalTo(concept.getAuthors().size())))) + .andExpect( + jsonPath("$[0].authors[0].firstName", is(concept.getAuthors().get(0).getFirstName()))); +===================================================================== +Found a 19 line (54 tokens) duplication in the following files: +Starting at line 50 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAccessWaysResourceControllerTest.java +Starting at line 48 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 40 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/StudySeriesesResourceControllerTest.java +Starting at line 49 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java +Starting at line 48 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 35 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectLastReleaseResourceTest.java +Starting at line 35 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectReleasesResourceTest.java +Starting at line 48 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java + + @Autowired + private ElasticsearchUpdateQueueItemRepository elasticsearchUpdateQueueItemRepository; + + @Autowired + private ElasticsearchAdminService elasticsearchAdminService; + + @Autowired + private JaversService javersService; + + private MockMvc mockMvc; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac).build(); + } + + @After + public void cleanUp() { + dataAcquisitionProjectRepository.deleteAll(); +===================================================================== +Found a 4 line (54 tokens) duplication in the following files: +Starting at line 329 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 357 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java + + mockMvc.perform(get(API_DATAPACKAGE_URI + "/" + dataPackage.getId())).andExpect(status().isOk()) + .andExpect(jsonPath("$.id", equalTo(dataPackage.getId()))) + .andExpect(jsonPath("$.masterId", equalTo(dataPackage.getMasterId()))) + .andExpect(jsonPath("$.release.version", equalTo("1.0.0"))) +===================================================================== +Found a 5 line (54 tokens) duplication in the following files: +Starting at line 91 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 131 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 157 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java + + .andExpect(jsonPath("$[0].title.de", is(dataPackage.getTitle().getDe()))) + .andExpect(jsonPath("$[0].projectContributors.length()", + is(equalTo(dataPackage.getProjectContributors().size())))) + .andExpect(jsonPath("$[0].projectContributors[0].firstName", + is(dataPackage.getProjectContributors().get(0).getFirstName()))); +===================================================================== +Found a 7 line (54 tokens) duplication in the following files: +Starting at line 101 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 239 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 255 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 284 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 365 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java + + DataSet dataSet = UnitTestCreateDomainObjectUtils.buildDataSet(project.getId(), survey.getId(), 1); + + // Act and Assert + // create the variable with the given id + mockMvc.perform(put(API_DATASETS_URI + "/" + dataSet.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataSet)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 21 line (54 tokens) duplication in the following files: +Starting at line 44 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 45 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java + + @Autowired + private InstrumentRepository instrumentRepository; + + @Autowired + private ElasticsearchUpdateQueueItemRepository elasticsearchUpdateQueueItemRepository; + + @Autowired + private ElasticsearchAdminService elasticsearchAdminService; + + @Autowired + private JaversService javersService; + + private MockMvc mockMvc; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac).build(); + } + + @After + public void cleanUp() { +===================================================================== +Found a 9 line (54 tokens) duplication in the following files: +Starting at line 310 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 890 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + .content(TestUtil.convertObjectToJsonBytes(instrument)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) + .andExpect(jsonPath("$.errors[0].message", containsString("global.error.shadow-save-not-allowed"))); + + } + + @Test + @WithMockUser(authorities=AuthoritiesConstants.PUBLISHER) + public void testDeleteInstrumentShadowCopy() throws Exception { +===================================================================== +Found a 5 line (54 tokens) duplication in the following files: +Starting at line 211 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResourceTest.java +Starting at line 165 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + + DataAcquisitionProject project = dataAcquisitionProjectRepository.findById(projectId).get(); + project.setRelease(null); + this.mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isNoContent()); +===================================================================== +Found a 11 line (54 tokens) duplication in the following files: +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 115 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 200 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 235 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java + + public void testCreateRelatedPublications() throws IOException, Exception { + // ARRANGE + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + DataPackage dataPackage = UnitTestCreateDomainObjectUtils.buildDataPackage(project.getId()); + dataPackageRepository.save(dataPackage); + RelatedPublication relatedPublication = + UnitTestCreateDomainObjectUtils.buildRelatedPublication(); + // ACT + // create the related publication with the given id + this.mockMvc.perform(put(API_RELATED_PUBLICATION_URI + "/" + relatedPublication.getId()) +===================================================================== +Found a 14 line (54 tokens) duplication in the following files: +Starting at line 50 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QDataSet.java +Starting at line 41 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSubDocument.java + + public final ListPath languages = this.createList("languages", String.class, StringPath.class, PathInits.DIRECT2); + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + public final StringPath masterId = createString("masterId"); + + public final NumberPath number = createNumber("number", Integer.class); + + //inherited + public final BooleanPath shadow = _super.shadow; +===================================================================== +Found a 4 line (53 tokens) duplication in the following files: +Starting at line 121 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java +Starting at line 143 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java + + .andExpect(jsonPath("$[1].version", is(equalTo(1)))) + .andExpect(jsonPath("$[1].authors.length()", is(equalTo(concept.getAuthors().size())))) + .andExpect( + jsonPath("$[1].authors[0].firstName", is(concept.getAuthors().get(0).getFirstName()))) +===================================================================== +Found a 6 line (53 tokens) duplication in the following files: +Starting at line 109 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 110 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 106 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + jsonPath("$.[0].dataPackageId", is(dataPackageAttachmentMetadata.getDataPackageId()))) + .andExpect(jsonPath("$.[0].version", is(0))) + .andExpect(jsonPath("$.[0].createdBy", is("test"))) + .andExpect(jsonPath("$.[0].lastModifiedBy", is("test"))) + .andExpect(jsonPath("$.[0].masterId", + is("/public/files/data-packages/" + "stu-projectid$/attachments/filename.txt"))); +===================================================================== +Found a 15 line (53 tokens) duplication in the following files: +Starting at line 75 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 53 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/StudySeriesesResourceControllerTest.java + + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac).addFilter(legacyUrlsFilter).build(); + } + + @After + public void cleanUp() { + dataAcquisitionProjectRepository.deleteAll(); + dataPackageRepository.deleteAll(); + elasticsearchUpdateQueueItemRepository.deleteAll(); + elasticsearchAdminService.recreateAllIndices(); + javersService.deleteAll(); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER) + public void testCreateDataPackage() throws IOException, Exception { +===================================================================== +Found a 12 line (53 tokens) duplication in the following files: +Starting at line 159 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 175 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 244 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java + + .build()); + + // create the project with the given id + mockMvc + .perform(put(API_DATAPACKAGE_URI + "/" + dataPackage.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataPackage))) + .andExpect(status().is4xxClientError()); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER) + public void testCreateDataPackageWithWrongId() throws IOException, Exception { +===================================================================== +Found a 5 line (53 tokens) duplication in the following files: +Starting at line 138 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 164 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java + + .andExpect(jsonPath("$[1].version", is(equalTo(1)))) + .andExpect(jsonPath("$[1].projectContributors.length()", + is(equalTo(dataPackage.getProjectContributors().size())))) + .andExpect(jsonPath("$[1].projectContributors[0].firstName", + is(dataPackage.getProjectContributors().get(0).getFirstName()))) +===================================================================== +Found a 8 line (53 tokens) duplication in the following files: +Starting at line 370 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 323 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 808 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + .content(TestUtil.convertObjectToJsonBytes(dataSet)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); + + mockMvc.perform(delete("/api/data-acquisition-projects/" + project.getId())) + .andExpect(status().is2xxSuccessful()); + + // check that the DataSet has been deleted + mockMvc.perform(get(API_DATASETS_URI + "/" + dataSet.getId())) +===================================================================== +Found a 8 line (53 tokens) duplication in the following files: +Starting at line 205 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 228 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 250 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 307 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java + + instrument.setType("HURZ"); + + // update the instrument with the given id + mockMvc.perform(put(API_INSTRUMENTS_URI + "/" + instrument.getId()) + .content(TestUtil.convertObjectToJsonBytes(instrument)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) + .andExpect( + jsonPath("$.errors[0].message", is("instrument-management.error.instrument.type.valid"))); +===================================================================== +Found a 7 line (53 tokens) duplication in the following files: +Starting at line 334 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 357 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 365 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java + + Configuration invalidConf = new Configuration(); + project.setConfiguration(invalidConf); + mockMvc + .perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))) + .andExpect(status().isBadRequest()); +===================================================================== +Found a 11 line (53 tokens) duplication in the following files: +Starting at line 267 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 284 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java + + question.setType(null); + + // Act and Assert + // create the variable with the given id + mockMvc.perform(put(API_QUESTIONS_URI + "/" + question.getId()) + .content(TestUtil.convertObjectToJsonBytes(question)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()); + } + + @Test + public void testCreateQuestionWithoutNumber() throws Exception { +===================================================================== +Found a 9 line (53 tokens) duplication in the following files: +Starting at line 112 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResponseRateImageResourceTest.java +Starting at line 192 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResponseRateImageResourceTest.java + + createResponseRateImageMetadata(); + MockMultipartFile metadata = new MockMultipartFile("surveyResponseRateImageMetadata", FILE_NAME, + "application/json", TestUtil.convertObjectToJsonBytes(surveyResponseRateImageMetadata)); + + // create the image + mockMvc + .perform( + MockMvcRequestBuilders.multipart("/api/surveys/images").file(attachment).file(metadata)) + .andExpect(status().isBadRequest()); +===================================================================== +Found a 10 line (53 tokens) duplication in the following files: +Starting at line 189 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 477 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 513 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 686 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 746 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + variable.setScaleLevel(null); + + // create the variable with a survey but without a project + mockMvc.perform(put(API_VARIABLES_URI + "/" + variable.getId()) + .content(TestUtil.convertObjectToJsonBytes(variable)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isBadRequest()); + } + + @Test + public void testCreateVariableWithWrongRepeatedMeasurementIdentifier() throws Exception { +===================================================================== +Found a 10 line (53 tokens) duplication in the following files: +Starting at line 460 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 495 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 553 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + variable.setScaleLevel(I18nString.builder().de("InvalidValue").en("InvalidValue").build()); + + // create the variable with a survey but without a project + mockMvc.perform(put(API_VARIABLES_URI + "/" + variable.getId()) + .content(TestUtil.convertObjectToJsonBytes(variable)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isBadRequest()); + } + + @Test + public void testCreateVariableWithoutDataType() throws Exception { +===================================================================== +Found a 11 line (53 tokens) duplication in the following files: +Starting at line 706 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 766 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + variable.getFilterDetails().setExpressionLanguage("WrongLanguage"); + + // Act and Assert + // create the variable with the given id + mockMvc.perform(put(API_VARIABLES_URI + "/" + variable.getId()) + .content(TestUtil.convertObjectToJsonBytes(variable)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isBadRequest()); + } + + @Test + public void testFilterExpressionLanguageWithSpelLanguage() throws Exception { +===================================================================== +Found a 13 line (53 tokens) duplication in the following files: +Starting at line 40 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/domain/QRelatedPublication.java +Starting at line 32 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationSubDocument.java + + public final StringPath doi = createString("doi"); + + public final StringPath id = createString("id"); + + public final StringPath language = createString("language"); + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + public final StringPath publicationAbstract = createString("publicationAbstract"); +===================================================================== +Found a 4 line (53 tokens) duplication in the following files: +Starting at line 120 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 164 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 145 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 164 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 109 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationSearchDocument.java +Starting at line 154 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java +Starting at line 176 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + public QConceptSearchDocument(Class type, PathMetadata metadata, PathInits inits) { + super(type, metadata, inits); + this.completeTitle = inits.isInitialized("completeTitle") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("completeTitle")) : null; + this.guiLabels = inits.isInitialized("guiLabels") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("guiLabels")) : null; +===================================================================== +Found a 15 line (53 tokens) duplication in the following files: +Starting at line 35 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageNestedDocument.java +Starting at line 39 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetNestedDocument.java +Starting at line 39 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentNestedDocument.java +Starting at line 37 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveyNestedDocument.java + + public final StringPath id = createString("id"); + + //inherited + public final StringPath lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate; + + public final StringPath masterId = createString("masterId"); + + public final BooleanPath shadow = createBoolean("shadow"); + + public final StringPath successorId = createString("successorId"); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString title; +===================================================================== +Found a 6 line (53 tokens) duplication in the following files: +Starting at line 35 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java +Starting at line 36 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 40 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java + + public final ListPath concepts = this.createList("concepts", ConceptSubDocument.class, QConceptSubDocument.class, PathInits.DIRECT2); + + public final eu.dzhw.fdz.metadatamanagement.projectmanagement.domain.QConfiguration configuration; + + //inherited + public final StringPath createdBy; +===================================================================== +Found a 6 line (53 tokens) duplication in the following files: +Starting at line 99 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java +Starting at line 95 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java + + public final ListPath questions = this.createList("questions", QuestionSubDocument.class, QQuestionSubDocument.class, PathInits.DIRECT2); + + public final eu.dzhw.fdz.metadatamanagement.projectmanagement.domain.QRelease release; + + //inherited + public final BooleanPath shadow; +===================================================================== +Found a 4 line (53 tokens) duplication in the following files: +Starting at line 88 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSubDocument.java +Starting at line 84 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSubDocument.java + + public QDataSetSubDocument(Class type, PathMetadata metadata, PathInits inits) { + super(type, metadata, inits); + this.description = inits.isInitialized("description") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("description")) : null; + this.format = inits.isInitialized("format") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("format")) : null; +===================================================================== +Found a 9 line (53 tokens) duplication in the following files: +Starting at line 85 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 91 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java + + public final ListPath nestedSurveys = this.createList("nestedSurveys", SurveyNestedDocument.class, QSurveyNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedVariables = this.createList("nestedVariables", VariableNestedDocument.class, QVariableNestedDocument.class, PathInits.DIRECT2); + + //inherited + public final NumberPath number = _super.number; + + //inherited + public final ListPath originalLanguages = _super.originalLanguages; +===================================================================== +Found a 16 line (52 tokens) duplication in the following files: +Starting at line 33 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/domain/validation/I18nStringEntireNotEmpty.java +Starting at line 34 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/domain/validation/ValidIsoLanguage.java +Starting at line 34 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/domain/validation/ConceptExists.java +Starting at line 34 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/domain/validation/DataPackageExists.java +Starting at line 34 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/domain/validation/VariableExists.java + + Class[]groups() default {}; + + /** + * This method contains the payload. + */ + Class[]payload() default {}; + + /** + * Defines several {@link I18nStringEntireNotEmpty} annotations on the same element. + * + * @see I18nStringEntireNotEmpty + */ + @Target({ElementType.TYPE, ElementType.TYPE_USE}) + @Retention(RetentionPolicy.RUNTIME) + @Documented + @interface List { +===================================================================== +Found a 6 line (52 tokens) duplication in the following files: +Starting at line 218 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java +Starting at line 243 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java +Starting at line 271 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java + + users.parallelStream().forEach(user -> { + Locale locale = Locale.forLanguageTag(user.getLangKey()); + Context context = new Context(locale); + context.setVariable("user", user); + context.setVariable("projectId", projectId); + context.setVariable("baseUrl", baseUrl); +===================================================================== +Found a 8 line (52 tokens) duplication in the following files: +Starting at line 84 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 113 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 145 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 177 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 266 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 63 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentVersionsResourceTest.java + + .buildConceptAttachmentMetadata("con-conceptid$"); + MockMultipartFile metadata = new MockMultipartFile("conceptAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(conceptAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/concepts/attachments") + .file(attachment) + .file(metadata)) + .andExpect(status().isCreated()); +===================================================================== +Found a 6 line (52 tokens) duplication in the following files: +Starting at line 94 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 123 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 156 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 189 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 281 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 63 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentVersionsResourceTest.java +Starting at line 75 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectAttachmentsResourceControllerTest.java + + UnitTestCreateDomainObjectUtils.buildDataPackageAttachmentMetadata("projectid"); + MockMultipartFile metadata = new MockMultipartFile("dataPackageAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(dataPackageAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/data-packages/attachments") + .file(attachment).file(metadata)).andExpect(status().isCreated()); +===================================================================== +Found a 25 line (52 tokens) duplication in the following files: +Starting at line 41 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 46 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java + +public class DataPackagePublicListResourceControllerTest extends AbstractTest { + private static final String API_DATAPACKAGE_URI = "/api/data-packages"; + + private static final String API_LEGACY_URI = "/api/studies"; + + @Autowired + private WebApplicationContext wac; + + @Autowired + private DataAcquisitionProjectRepository dataAcquisitionProjectRepository; + + @Autowired + private DataPackageRepository dataPackageRepository; + + @Autowired + private ElasticsearchUpdateQueueItemRepository elasticsearchUpdateQueueItemRepository; + + @Autowired + private ElasticsearchAdminService elasticsearchAdminService; + + @Autowired + private JaversService javersService; + + @Autowired + private LegacyUrlsFilter legacyUrlsFilter; +===================================================================== +Found a 8 line (52 tokens) duplication in the following files: +Starting at line 120 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java +Starting at line 120 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java +Starting at line 120 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java +Starting at line 121 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionImageShadowCopyServiceTest.java + + DataPackageAttachmentMetadata shadow = createShadow(master, "1.0.0"); + createTestFileForAttachment(shadow); + + shadowCopyService.createShadowCopies(dataAcquisitionProject.getId(), + dataAcquisitionProject.getRelease(), "1.0.0"); + + List files = new ArrayList<>(); + gridFsOperations.find(new Query()).iterator().forEachRemaining(files::add); +===================================================================== +Found a 8 line (52 tokens) duplication in the following files: +Starting at line 95 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 124 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 157 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 189 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 281 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java + + .buildDataSetAttachmentMetadata("projectid", 1); + MockMultipartFile metadata = new MockMultipartFile("dataSetAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(dataSetAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/data-sets/attachments") + .file(attachment) + .file(metadata)) + .andExpect(status().isCreated()); +===================================================================== +Found a 6 line (52 tokens) duplication in the following files: +Starting at line 79 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 105 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 137 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 181 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 261 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 63 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentVersionsResourceTest.java +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectAttachmentsResourceControllerTest.java + + UnitTestCreateDomainObjectUtils.buildInstrumentAttachmentMetadata("projectid", 1); + MockMultipartFile metadata = new MockMultipartFile("instrumentAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(instrumentAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/instruments/attachments") + .file(attachment).file(metadata)).andExpect(status().isCreated()); +===================================================================== +Found a 9 line (52 tokens) duplication in the following files: +Starting at line 205 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResponseRateImageResourceTest.java +Starting at line 220 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResponseRateImageResourceTest.java + + public void testDeleteAllResponseRateImagesOfSurvey() throws Exception { + SurveyResponseRateImageMetadata metadata = createResponseRateImageMetadata(); + createTestFileForSurveyRateImage(metadata); + + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(PROJECT_ID); + survey.setId(survey.getId() + "-1.0.0"); + surveyRepository.save(survey); + + mockMvc.perform(delete("/api/surveys/" + SURVEY_ID + "-1.0.0/images")) +===================================================================== +Found a 13 line (52 tokens) duplication in the following files: +Starting at line 82 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/service/UserServiceTest.java +Starting at line 102 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/service/UserServiceTest.java + + user.setResetKey(resetKey); + + userRepository.save(user); + + Optional maybeUser = userService.completePasswordReset("johndoe2", user.getResetKey()); + + assertThat(maybeUser.isPresent()).isFalse(); + + userRepository.deleteById(user.getId()); + } + + @Test + public void assertThatResetKeyMustBeValid() { +===================================================================== +Found a 9 line (52 tokens) duplication in the following files: +Starting at line 103 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 135 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 180 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 198 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 216 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 234 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 260 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 288 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 318 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 346 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 368 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 397 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 429 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 451 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 469 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 486 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 504 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 543 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 562 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 581 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 639 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 676 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 696 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 716 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 736 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 756 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 776 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 797 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 823 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 842 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + public void testCreateVariable() throws Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + List surveyNumbers = new ArrayList<>(); + surveyNumbers.add(1); + + Variable variable = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "var1", 1, surveyNumbers); +===================================================================== +Found a 9 line (52 tokens) duplication in the following files: +Starting at line 619 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 805 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + .en(ScaleLevels.ORDINAL.getEn()).build()); + + // create the variable with the given id + mockMvc.perform(put(API_VARIABLES_URI + "/" + variable.getId()) + .content(TestUtil.convertObjectToJsonBytes(variable)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); + + // delete the variable + mockMvc.perform(delete(API_VARIABLES_URI + "/" + variable.getId())) +===================================================================== +Found a 4 line (52 tokens) duplication in the following files: +Starting at line 61 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 125 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 53 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSubDocument.java + + public final ListPath sponsors = this.createList("sponsors", eu.dzhw.fdz.metadatamanagement.common.domain.I18nString.class, eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString.class, PathInits.DIRECT2); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString studySeries = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("studySeries")); +===================================================================== +Found a 18 line (51 tokens) duplication in the following files: +Starting at line 181 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentService.java +Starting at line 192 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentService.java + + mongoTemplate.getConverter().read(DataPackageAttachmentMetadata.class, file.getMetadata()); + if (metadata.isShadow()) { + throw new ShadowCopyDeleteNotAllowedException(); + } + String currentUser = SecurityUtils.getCurrentUserLogin(); + this.operations.delete(fileQuery); + javers.commitShallowDelete(currentUser, metadata); + } + + /** + * Attach the given file as data package overview to the data package. + * + * @param language The language of the report. + * @param dataPackageId The id of a {@link DataPackage}. + * @param overviewFile The pdf file. + * @throws IOException Thrown if the multipart file cannot be read. + */ + public void attachDataPackageOverview(String dataPackageId, String language, +===================================================================== +Found a 12 line (51 tokens) duplication in the following files: +Starting at line 97 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/helper/DataPackageShadowCopyDataSource.java +Starting at line 104 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/helper/DataSetShadowCopyDataSource.java +Starting at line 106 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/helper/InstrumentShadowCopyDataSource.java +Starting at line 107 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/helper/QuestionShadowCopyDataSource.java +Starting at line 97 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/helper/SurveyShadowCopyDataSource.java +Starting at line 138 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/helper/VariableShadowCopyDataSource.java + + }, ElasticsearchType.data_packages); + } + } + + @Override + public void hideExistingShadowCopies(String projectId, String version) { + setHiddenState(projectId, version, true); + } + + private void setHiddenState(String projectId, String version, boolean hidden) { + String shadowId = projectId + "-" + version; + try (Stream dataPackages = +===================================================================== +Found a 6 line (51 tokens) duplication in the following files: +Starting at line 99 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java +Starting at line 115 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java + + log.debug("Sending activation e-mail to '{}'", user.getEmail()); + Locale locale = Locale.forLanguageTag(user.getLangKey()); + Context context = new Context(locale); + context.setVariable("user", user); + context.setVariable("baseUrl", baseUrl); + String content = templateEngine.process("activationEmail", context); +===================================================================== +Found a 17 line (51 tokens) duplication in the following files: +Starting at line 43 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DeleteAllDataPackagesResourceControllerTest.java +Starting at line 44 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DeleteAllDateSetsResourceControllerTest.java +Starting at line 47 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/DeleteAllInstrumentsResourceControllerTest.java +Starting at line 41 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/DeleteAllQuestionsResourceControllerTest.java +Starting at line 45 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/DeleteAllSurveysResourceControllerTest.java +Starting at line 44 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/DeleteAllVariablesResourceControllerTest.java + + @Autowired + private ElasticsearchUpdateQueueItemRepository elasticsearchUpdateQueueItemRepository; + + @Autowired + private ElasticsearchAdminService elasticsearchAdminService; + + @Autowired + private JaversService javersService; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac).build(); + } + + @After + public void cleanUp() { + dataAcquisitionProjectRepository.deleteAll(); +===================================================================== +Found a 19 line (51 tokens) duplication in the following files: +Starting at line 40 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/AvailableDataSetNumbersResourceControllerTest.java +Starting at line 35 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/AvailableInstrumentNumbersResourceControllerTest.java +Starting at line 35 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/AvailableSurveyNumbersResourceControllerTest.java + + @Autowired + private DataAcquisitionProjectRepository rdcProjectRepository; + + @Autowired + private ElasticsearchUpdateQueueItemRepository elasticsearchUpdateQueueItemRepository; + + @Autowired + private ElasticsearchAdminService elasticsearchAdminService; + + @Autowired + private JaversService javersService; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac).build(); + } + + @After + public void cleanUp() { +===================================================================== +Found a 20 line (51 tokens) duplication in the following files: +Starting at line 65 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 62 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java + + @Autowired + private ElasticsearchUpdateQueueService elasticsearchUpdateQueueService; + + @Autowired + private ElasticsearchAdminService elasticsearchAdminService; + + @Autowired + private JaversService javersService; + + private MockMvc mockMvc; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac) + .build(); + } + + @After + public void cleanUp() { + this.dataAcquisitionProjectRepository.deleteAll(); +===================================================================== +Found a 12 line (51 tokens) duplication in the following files: +Starting at line 165 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 184 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 200 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java + + DataSet dataSet = UnitTestCreateDomainObjectUtils.buildDataSet(null, survey.getId(), 1); + + + // Act and Assert + // create the DataSet with a survey but without a project + mockMvc.perform(put(API_DATASETS_URI + "/" + dataSet.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataSet)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()); + } + + @Test + public void testCreateDataSetWithWrongFormat() throws Exception { +===================================================================== +Found a 8 line (51 tokens) duplication in the following files: +Starting at line 176 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 194 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java + + public void testCreateDataSetWithWrongFormat() throws Exception { + // Arrange + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + this.dataAcquisitionProjectRepository.save(project); + + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); + + DataSet dataSet = UnitTestCreateDomainObjectUtils.buildDataSet(null, survey.getId(), 1); +===================================================================== +Found a 4 line (51 tokens) duplication in the following files: +Starting at line 176 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 103 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 147 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + + mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isCreated()); + project.setVersion(0L); +===================================================================== +Found a 5 line (51 tokens) duplication in the following files: +Starting at line 67 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/service/DataAcquisitionProjectVersionsServiceTest.java +Starting at line 81 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/service/DataAcquisitionProjectVersionsServiceTest.java + + project.setRelease(Release.builder().version("0.1.0").lastDate(LocalDateTime.now()).build()); + project = projectManagementService.save(project); + + previousRelease = versionsService.findPreviousRelease(project.getId(), project.getRelease()); + assertThat(previousRelease.getVersion(), equalTo("0.0.1")); +===================================================================== +Found a 10 line (51 tokens) duplication in the following files: +Starting at line 267 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 284 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 301 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java + + question.setType(null); + + // Act and Assert + // create the variable with the given id + mockMvc.perform(put(API_QUESTIONS_URI + "/" + question.getId()) + .content(TestUtil.convertObjectToJsonBytes(question)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()); + } + + @Test +===================================================================== +Found a 6 line (51 tokens) duplication in the following files: +Starting at line 136 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 190 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + survey.setDataType(I18nString.builder().de("Mixed Methods").en("Mixed Methods").build()); + + // create the survey with the given id but with wrong period + mockMvc.perform(put(API_SURVEYS_URI + "/" + survey.getId()) + .content(TestUtil.convertObjectToJsonBytes(survey)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) +===================================================================== +Found a 10 line (51 tokens) duplication in the following files: +Starting at line 191 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 212 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 231 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + .build()); + + // create the survey with the given id but with an unlimited period + mockMvc.perform(put(API_SURVEYS_URI + "/" + survey.getId()) + .content(TestUtil.convertObjectToJsonBytes(survey)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()); + } + + @Test + public void testCreateSurveyWithInvalidProject() throws Exception { +===================================================================== +Found a 4 line (51 tokens) duplication in the following files: +Starting at line 157 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/UserResourceTest.java +Starting at line 171 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/UserResourceTest.java + + restUserMockMvc + .perform(get("/api//users/findUserWithRole/").param("login", login).param("role", role) + .contentType(TestUtil.APPLICATION_JSON_UTF8).accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()).andExpect(jsonPath("$.[0].login").value("user")); +===================================================================== +Found a 10 line (51 tokens) duplication in the following files: +Starting at line 171 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 189 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 207 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 225 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 460 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 477 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 495 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 513 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 534 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 553 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 571 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 686 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 706 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 746 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 766 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + UnitTestCreateDomainObjectUtils.buildVariable(null, 1, "var1", 1, surveyNumbers); + + // create the variable with a survey but without a project + mockMvc.perform(put(API_VARIABLES_URI + "/" + variable.getId()) + .content(TestUtil.convertObjectToJsonBytes(variable)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isBadRequest()); + } + + @Test + public void testCreateVariableWithoutScaleLevel() throws Exception { +===================================================================== +Found a 10 line (51 tokens) duplication in the following files: +Starting at line 251 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 277 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 726 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + variable.getDistribution().getStatistics().setFirstQuartile("2017-01-30"); + + // create the variable with a survey but without a project + mockMvc.perform(put(API_VARIABLES_URI + "/" + variable.getId()) + .content(TestUtil.convertObjectToJsonBytes(variable)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); + } + + @Test + public void testCreateDateVariableWithNominalScaleLevel() throws Exception { +===================================================================== +Found a 9 line (51 tokens) duplication in the following files: +Starting at line 53 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/domain/QConcept.java +Starting at line 73 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 79 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QSurvey.java + + public final QTags tags = new QTags(forProperty("tags")); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString title = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("title")); + + //inherited + public final NumberPath version = _super.version; + + public QConcept(String variable) { +===================================================================== +Found a 14 line (51 tokens) duplication in the following files: +Starting at line 50 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QDataSet.java +Starting at line 46 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java +Starting at line 41 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySubDocument.java +Starting at line 48 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QSurvey.java + + public final ListPath languages = this.createList("languages", String.class, StringPath.class, PathInits.DIRECT2); + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + public final StringPath masterId = createString("masterId"); + + public final NumberPath number = createNumber("number", Integer.class); + + //inherited + public final BooleanPath shadow = _super.shadow; +===================================================================== +Found a 3 line (51 tokens) duplication in the following files: +Starting at line 63 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QAbstractNestedSubDocument.java +Starting at line 120 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 164 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 145 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 164 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 109 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationSearchDocument.java +Starting at line 154 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java +Starting at line 176 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + public QAbstractNestedSubDocument(Class type, PathMetadata metadata, PathInits inits) { + super(type, metadata, inits); + this.completeTitle = inits.isInitialized("completeTitle") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("completeTitle")) : null; +===================================================================== +Found a 6 line (51 tokens) duplication in the following files: +Starting at line 99 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java +Starting at line 95 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 102 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java + + public final ListPath questions = this.createList("questions", QuestionSubDocument.class, QQuestionSubDocument.class, PathInits.DIRECT2); + + public final eu.dzhw.fdz.metadatamanagement.projectmanagement.domain.QRelease release; + + //inherited + public final BooleanPath shadow; +===================================================================== +Found a 10 line (50 tokens) duplication in the following files: +Starting at line 57 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentService.java +Starting at line 60 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentService.java +Starting at line 55 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentService.java +Starting at line 53 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentService.java +Starting at line 44 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyResponseRateImageService.java + + DataPackageAttachmentMetadata metadata) throws IOException { + + if (metadata.isShadow()) { + throw new ShadowCopyCreateNotAllowedException(); + } + + String currentUser = SecurityUtils.getCurrentUserLogin(); + attachmentMetadataHelper.initAttachmentMetadata(metadata, currentUser); + metadata.generateId(); + metadata.setMasterId(metadata.getId()); +===================================================================== +Found a 8 line (50 tokens) duplication in the following files: +Starting at line 118 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageOverviewService.java +Starting at line 175 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetReportService.java + + String mainFilledStr = + this.fillTemplate(texMainFileStr, templateConfiguration, dataForTemplate, KEY_MAIN); + ZipUtil.writeFileToZip(pathToMainTexFile, mainFilledStr); + } catch (TemplateException e) { + log.debug("fill template fails", e); + task = taskService.handleErrorTask(task, e); + return; + } +===================================================================== +Found a 6 line (50 tokens) duplication in the following files: +Starting at line 214 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentService.java +Starting at line 228 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentService.java + + case "de": + metadata = DataSetAttachmentMetadata.builder().dataSetId(dataSetId) + .dataAcquisitionProjectId(dataSet.getDataAcquisitionProjectId()) + .dataSetNumber(dataSet.getNumber()) + .fileName("dsreport-" + dataSet.getDataAcquisitionProjectId() + "-ds" + + dataSet.getNumber() + ".pdf") +===================================================================== +Found a 9 line (50 tokens) duplication in the following files: +Starting at line 185 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentService.java +Starting at line 179 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentService.java + + mongoTemplate.getConverter().read(InstrumentAttachmentMetadata.class, file.getMetadata()); + if (metadata.isShadow()) { + throw new ShadowCopyDeleteNotAllowedException(); + } + String currentUser = SecurityUtils.getCurrentUserLogin(); + this.operations.delete(fileQuery); + javers.commitShallowDelete(currentUser, metadata); + } +} +===================================================================== +Found a 10 line (50 tokens) duplication in the following files: +Starting at line 310 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 358 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 392 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 445 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 552 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 600 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java + + questions, instruments, surveys, dataSets, variables); + + request.add(new IndexRequest(lockedItem.getDocumentType().name()).id(searchDocument.getId()) + .source(gson.toJson(searchDocument), XContentType.JSON)); + return true; + } + return false; + } + + private boolean addUpsertActionForInstrument(ElasticsearchUpdateQueueItem lockedItem, +===================================================================== +Found a 11 line (50 tokens) duplication in the following files: +Starting at line 50 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/helper/SurveyAttachmentShadowCopyDataSource.java +Starting at line 52 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/helper/SurveyResponseRateImageShadowCopyDataSource.java + + BeanUtils.copyProperties(source, copy, "version"); + } + + copy.setDataAcquisitionProjectId( + source.getDataAcquisitionProjectId() + "-" + release.getVersion()); + copy.setSurveyId(source.getSurveyId() + "-" + release.getVersion()); + copy.generateId(); + return copy; + } + + private String deriveId(SurveyAttachmentMetadata source, String version) { +===================================================================== +Found a 9 line (50 tokens) duplication in the following files: +Starting at line 239 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 266 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java + + conceptAttachmentMetadata.setDescription(new I18nString()); + + MockMultipartFile metadata = new MockMultipartFile("conceptAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(conceptAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/concepts/attachments") + .file(attachment) + .file(metadata)) + .andExpect(status().isBadRequest()) +===================================================================== +Found a 9 line (50 tokens) duplication in the following files: +Starting at line 256 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 281 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java + + dataPackageAttachmentMetadata.setDescription(new I18nString()); + + MockMultipartFile metadata = new MockMultipartFile("dataPackageAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(dataPackageAttachmentMetadata)); + + mockMvc + .perform(MockMvcRequestBuilders.multipart("/api/data-packages/attachments").file(attachment) + .file(metadata)) + .andExpect(status().isBadRequest()).andExpect(jsonPath("$.errors[0].message", is( +===================================================================== +Found a 9 line (50 tokens) duplication in the following files: +Starting at line 313 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 315 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 109 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionImageResourceTest.java +Starting at line 293 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 198 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResponseRateImageResourceTest.java + + .perform(MockMvcRequestBuilders.multipart("/api/data-packages/attachments").file(attachment) + .file(metadata)) + .andExpect(status().isBadRequest()).andExpect(jsonPath("$.errors[0].message", + containsString("global.error.shadow-create-not-allowed"))); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER) + public void testUpdateAttachmentOfShadowCopyDataPackage() throws Exception { +===================================================================== +Found a 8 line (50 tokens) duplication in the following files: +Starting at line 138 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java +Starting at line 138 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java +Starting at line 135 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java + + mongoTemplate.getConverter().read(DataPackageAttachmentMetadata.class, shadowFile.getMetadata()); + + assertThat(metadata.getSuccessorId(), nullValue()); + assertThat(shadowFile.getMetadata().get("_contentType"), equalTo("text/plain")); + } + + @Test + public void createShadowCopyLinkPredecessorToSuccessor() throws Exception { +===================================================================== +Found a 9 line (50 tokens) duplication in the following files: +Starting at line 186 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java +Starting at line 186 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java +Starting at line 189 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java +Starting at line 187 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionImageShadowCopyServiceTest.java +Starting at line 183 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java + + DataPackageAttachmentMetadata shadow = createShadow(master, "1.0.0"); + createTestFileForAttachment(shadow); + release.setVersion("1.0.1"); + + shadowCopyService.createShadowCopies(dataAcquisitionProject.getId(), + dataAcquisitionProject.getRelease(), "1.0.0"); + + Query shadowQuery = new Query(GridFsCriteria.whereFilename() + .is("/data-packages/stu-" + PROJECT_ID + "$-1.0.0/attachments/filename.txt")); +===================================================================== +Found a 9 line (50 tokens) duplication in the following files: +Starting at line 253 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 281 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java + + dataSetAttachmentMetadata.setDescription(new I18nString()); + + MockMultipartFile metadata = new MockMultipartFile("dataSetAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(dataSetAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/data-sets/attachments") + .file(attachment) + .file(metadata)) + .andExpect(status().isBadRequest()) +===================================================================== +Found a 7 line (50 tokens) duplication in the following files: +Starting at line 101 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 165 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 200 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 239 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 255 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 284 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 365 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java + + DataSet dataSet = UnitTestCreateDomainObjectUtils.buildDataSet(project.getId(), survey.getId(), 1); + + // Act and Assert + // create the variable with the given id + mockMvc.perform(put(API_DATASETS_URI + "/" + dataSet.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataSet)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 9 line (50 tokens) duplication in the following files: +Starting at line 234 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 261 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java + + instrumentAttachmentMetadata.setDescription(new I18nString()); + + MockMultipartFile metadata = new MockMultipartFile("instrumentAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(instrumentAttachmentMetadata)); + + mockMvc + .perform(MockMvcRequestBuilders.multipart("/api/instruments/attachments").file(attachment) + .file(metadata)) + .andExpect(status().isBadRequest()).andExpect(jsonPath("$.errors[0].message", is( +===================================================================== +Found a 8 line (50 tokens) duplication in the following files: +Starting at line 87 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 137 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 155 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 79 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + // create the project with the given id + mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isCreated()); + + // read the project under the new url + mockMvc.perform(get(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId())) +===================================================================== +Found a 8 line (50 tokens) duplication in the following files: +Starting at line 420 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 481 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java + + project.setLastAssigneeGroupMessage("test"); + + project = rdcProjectRepository.save(project); + + mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .content(TestUtil.convertObjectToJsonBytes(project)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isNoContent()); +===================================================================== +Found a 9 line (50 tokens) duplication in the following files: +Starting at line 233 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 260 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + surveyAttachmentMetadata.setDescription(new I18nString()); + + MockMultipartFile metadata = new MockMultipartFile("surveyAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(surveyAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/surveys/attachments") + .file(attachment) + .file(metadata)) + .andExpect(status().isBadRequest()) +===================================================================== +Found a 7 line (50 tokens) duplication in the following files: +Starting at line 166 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 223 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + .dataAcquisitionProjectId(project.getId()) + .title(I18nString.builder().de("titel") + .en("title") + .build()) + .fieldPeriod(Period.builder().start(LocalDate.now()) + .end(LocalDate.now() + .minusDays(1)) +===================================================================== +Found a 9 line (50 tokens) duplication in the following files: +Starting at line 294 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 320 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 333 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); + + // create the survey with the given id + mockMvc.perform(put(API_SURVEYS_URI + "/" + survey.getId()) + .content(TestUtil.convertObjectToJsonBytes(survey)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); + + // delete the survey + mockMvc.perform(delete(API_SURVEYS_URI + "/" + survey.getId())) +===================================================================== +Found a 6 line (50 tokens) duplication in the following files: +Starting at line 111 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 171 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 805 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "var1", 1, surveyNumbers); + + // create the variable with the given id + mockMvc.perform(put(API_VARIABLES_URI + "/" + variable.getId()) + .content(TestUtil.convertObjectToJsonBytes(variable)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); +===================================================================== +Found a 6 line (50 tokens) duplication in the following files: +Starting at line 111 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 589 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 646 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 805 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "var1", 1, surveyNumbers); + + // create the variable with the given id + mockMvc.perform(put(API_VARIABLES_URI + "/" + variable.getId()) + .content(TestUtil.convertObjectToJsonBytes(variable)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); +===================================================================== +Found a 6 line (50 tokens) duplication in the following files: +Starting at line 21 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QDataSet.java +Starting at line 21 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java +Starting at line 21 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/domain/QQuestion.java +Starting at line 20 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QSurvey.java + + public static final QDataPackage dataPackage = new QDataPackage("dataPackage"); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractShadowableRdcDomainObject _super = new eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractShadowableRdcDomainObject(this); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("annotations")); +===================================================================== +Found a 9 line (50 tokens) duplication in the following files: +Starting at line 72 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QDataSet.java +Starting at line 87 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/domain/QQuestion.java + + public final ListPath> surveyNumbers = this.>createList("surveyNumbers", Integer.class, NumberPath.class, PathInits.DIRECT2); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString type = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("type")); + + //inherited + public final NumberPath version = _super.version; + + public QDataSet(String variable) { +===================================================================== +Found a 15 line (49 tokens) duplication in the following files: +Starting at line 99 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptAttachmentService.java +Starting at line 141 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentService.java +Starting at line 153 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentService.java +Starting at line 146 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentService.java + + result.add(mongoTemplate.getConverter().read(ConceptAttachmentMetadata.class, + gridfsFile.getMetadata())); + }); + return result; + } + + + + /** + * Delete all attachments of all {@link Concept}s. + */ + public void deleteAll() { + String currentUser = SecurityUtils.getCurrentUserLogin(); + Query query = new Query(GridFsCriteria.whereFilename() + .regex("^" + Pattern.quote("/concepts/") + ".*" + Pattern.quote("/attachments/"))); +===================================================================== +Found a 8 line (49 tokens) duplication in the following files: +Starting at line 181 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentService.java +Starting at line 192 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentService.java +Starting at line 185 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentService.java +Starting at line 179 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentService.java + + mongoTemplate.getConverter().read(DataPackageAttachmentMetadata.class, file.getMetadata()); + if (metadata.isShadow()) { + throw new ShadowCopyDeleteNotAllowedException(); + } + String currentUser = SecurityUtils.getCurrentUserLogin(); + this.operations.delete(fileQuery); + javers.commitShallowDelete(currentUser, metadata); + } +===================================================================== +Found a 10 line (49 tokens) duplication in the following files: +Starting at line 99 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/helper/DataPackageShadowCopyDataSource.java +Starting at line 106 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/helper/DataSetShadowCopyDataSource.java +Starting at line 108 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/helper/InstrumentShadowCopyDataSource.java +Starting at line 85 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/service/helper/DataAcquisitionProjectShadowCopyDataSource.java +Starting at line 109 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/helper/QuestionShadowCopyDataSource.java +Starting at line 99 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/helper/SurveyShadowCopyDataSource.java +Starting at line 140 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/helper/VariableShadowCopyDataSource.java + + } + + @Override + public void hideExistingShadowCopies(String projectId, String version) { + setHiddenState(projectId, version, true); + } + + private void setHiddenState(String projectId, String version, boolean hidden) { + String shadowId = projectId + "-" + version; + try (Stream dataPackages = +===================================================================== +Found a 6 line (49 tokens) duplication in the following files: +Starting at line 204 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetManagementService.java +Starting at line 186 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentManagementService.java +Starting at line 218 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyManagementService.java + + .max((dataSet1, dataSet2) -> Integer.compare(dataSet1.getNumber(), dataSet2.getNumber())); + if (!max.isPresent()) { + result.add(1); + } else { + for (int i = 1; i < max.get().getNumber(); i++) { + if (!dataSetNumberExists(existingNumbers, i)) { +===================================================================== +Found a 10 line (49 tokens) duplication in the following files: +Starting at line 310 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 392 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 482 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java + + questions, instruments, surveys, dataSets, variables); + + request.add(new IndexRequest(lockedItem.getDocumentType().name()).id(searchDocument.getId()) + .source(gson.toJson(searchDocument), XContentType.JSON)); + return true; + } + return false; + } + + private boolean addUpsertActionForInstrument(ElasticsearchUpdateQueueItem lockedItem, +===================================================================== +Found a 5 line (49 tokens) duplication in the following files: +Starting at line 99 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 109 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 110 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 92 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 106 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + .andExpect(jsonPath("$.[0].conceptId", is(conceptAttachmentMetadata.getConceptId()))) + .andExpect(jsonPath("$.[0].version", is(0))) + .andExpect(jsonPath("$.[0].createdBy", is("test"))) + .andExpect(jsonPath("$.[0].lastModifiedBy", is("test"))) + .andExpect(jsonPath("$.[0].id", is("/public/files/concepts/" +===================================================================== +Found a 8 line (49 tokens) duplication in the following files: +Starting at line 219 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 266 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java + + conceptAttachmentMetadata.setType(new I18nString("hurz","hurz")); + MockMultipartFile metadata = new MockMultipartFile("conceptAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(conceptAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/concepts/attachments") + .file(attachment) + .file(metadata)) + .andExpect(status().isBadRequest()) +===================================================================== +Found a 7 line (49 tokens) duplication in the following files: +Starting at line 91 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentVersionsResourceTest.java +Starting at line 92 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentVersionsResourceTest.java +Starting at line 91 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentVersionsResourceTest.java +Starting at line 91 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentVersionsResourceTest.java +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentVersionsResourceTest.java + + + conceptAttachmentMetadata.getFileName() + "/versions")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(2))); + } + + @Test + public void testVersionsNotFound() throws Exception { + mockMvc.perform(get("/api/concepts/spaß/attachments/file/versions")) +===================================================================== +Found a 18 line (49 tokens) duplication in the following files: +Starting at line 58 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 43 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java +Starting at line 50 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAccessWaysResourceControllerTest.java +Starting at line 48 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 40 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/StudySeriesesResourceControllerTest.java +Starting at line 49 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java +Starting at line 47 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 48 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 35 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectLastReleaseResourceTest.java +Starting at line 35 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectReleasesResourceTest.java +Starting at line 48 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java + + @Autowired + private ElasticsearchUpdateQueueItemRepository elasticsearchUpdateQueueItemRepository; + + @Autowired + private ElasticsearchAdminService elasticsearchAdminService; + + @Autowired + private JaversService javersService; + + private MockMvc mockMvc; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac).build(); + } + + @After + public void cleanUp() { +===================================================================== +Found a 5 line (49 tokens) duplication in the following files: +Starting at line 220 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 168 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java + + jsonPath("$.[0].dataPackageId", is(dataPackageAttachmentMetadata.getDataPackageId()))) + .andExpect(jsonPath("$.[0].version", is(1))) + .andExpect(jsonPath("$.[0].createdBy", is("test"))) + .andExpect(jsonPath("$.[0].lastModifiedBy", is("test"))) + .andExpect(jsonPath("$.[0].masterId", +===================================================================== +Found a 8 line (49 tokens) duplication in the following files: +Starting at line 237 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 281 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java + + dataPackageAttachmentMetadata.setType(new I18nString("hurz", "hurz")); + MockMultipartFile metadata = new MockMultipartFile("dataPackageAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(dataPackageAttachmentMetadata)); + + mockMvc + .perform(MockMvcRequestBuilders.multipart("/api/data-packages/attachments").file(attachment) + .file(metadata)) + .andExpect(status().isBadRequest()).andExpect(jsonPath("$.errors[0].message", +===================================================================== +Found a 9 line (49 tokens) duplication in the following files: +Starting at line 358 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 337 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + mockMvc.perform(delete("/api/data-packages/" + dataPackageId + "/attachments")) + .andExpect(status().isBadRequest()).andExpect(jsonPath("$.errors[0].message", + containsString("global.error.shadow-delete-not-allowed"))); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER) + public void testDeleteAttachmentOfShadowCopyDataPackage() throws Exception { + String dataPackageId = "ins-issue1991-1.0.0"; +===================================================================== +Found a 19 line (49 tokens) duplication in the following files: +Starting at line 65 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 62 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 59 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + @Autowired + private ElasticsearchUpdateQueueService elasticsearchUpdateQueueService; + + @Autowired + private ElasticsearchAdminService elasticsearchAdminService; + + @Autowired + private JaversService javersService; + + private MockMvc mockMvc; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac) + .build(); + } + + @After + public void cleanUp() { +===================================================================== +Found a 9 line (49 tokens) duplication in the following files: +Starting at line 157 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 357 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java + + public void testCreateDataSetWithSurveyButWithoutProject() throws Exception { + // Arrange + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + this.dataAcquisitionProjectRepository.save(project); + + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); + this.surveyRepository.save(survey); + + DataSet dataSet = UnitTestCreateDomainObjectUtils.buildDataSet(null, survey.getId(), 1); +===================================================================== +Found a 7 line (49 tokens) duplication in the following files: +Starting at line 166 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetShadowCopyServiceTest.java +Starting at line 158 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentShadowCopyServiceTest.java +Starting at line 167 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyShadowCopyServiceTest.java + + DataSet shadow = new DataSet(master); + shadow.setId(master.getId() + "-" + version); + shadow.setDataPackageId(master.getDataPackageId() + "-" + version); + shadow.setDataAcquisitionProjectId(master.getDataAcquisitionProjectId() + "-" + version); + return shadow; + } +} +===================================================================== +Found a 8 line (49 tokens) duplication in the following files: +Starting at line 215 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 261 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java + + instrumentAttachmentMetadata.setType(new I18nString("hurz", "hurz")); + MockMultipartFile metadata = new MockMultipartFile("instrumentAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(instrumentAttachmentMetadata)); + + mockMvc + .perform(MockMvcRequestBuilders.multipart("/api/instruments/attachments").file(attachment) + .file(metadata)) + .andExpect(status().isBadRequest()).andExpect(jsonPath("$.errors[0].message", +===================================================================== +Found a 15 line (49 tokens) duplication in the following files: +Starting at line 54 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java +Starting at line 82 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + @Autowired + private JaversService javersService; + + private MockMvc mockMvc; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac) + .build(); + } + + @After + public void cleanUp() { + dataAcquisitionProjectRepository.deleteAll(); + surveyRepository.deleteAll(); +===================================================================== +Found a 9 line (49 tokens) duplication in the following files: +Starting at line 251 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 277 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 726 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 786 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + variable.getDistribution().getStatistics().setFirstQuartile("2017-01-30"); + + // create the variable with a survey but without a project + mockMvc.perform(put(API_VARIABLES_URI + "/" + variable.getId()) + .content(TestUtil.convertObjectToJsonBytes(variable)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); + } + + @Test +===================================================================== +Found a 8 line (49 tokens) duplication in the following files: +Starting at line 562 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 581 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 608 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 639 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + public void testCreateVariableWithInvalidId() throws Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + List surveyNumbers = new ArrayList<>(); + surveyNumbers.add(1); + Variable variable = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "var", 1, surveyNumbers); +===================================================================== +Found a 5 line (49 tokens) duplication in the following files: +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/QVariable.java + + public final ListPath accessWays = this.createList("accessWays", String.class, StringPath.class, PathInits.DIRECT2); + + // custom + // inherited + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(_super.annotations); +===================================================================== +Found a 7 line (49 tokens) duplication in the following files: +Starting at line 116 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java +Starting at line 113 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java + + public final ListPath> surveyNumbers; + + public final ListPath surveys = this.createList("surveys", SurveySubDocument.class, QSurveySubDocument.class, PathInits.DIRECT2); + + // custom + // inherited + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString type; +===================================================================== +Found a 9 line (48 tokens) duplication in the following files: +Starting at line 57 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/service/MarkdownHelper.java +Starting at line 62 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/AccessWays.java + + public TemplateMethodModelEx createRemoveMarkdownMethod() { + return new TemplateMethodModelEx() { + @SuppressWarnings("rawtypes") + @Override + public TemplateModel exec(List arguments) throws TemplateModelException { + if (arguments.size() != 1) { + throw new TemplateModelException("Wrong arguments"); + } + return new SimpleScalar(getPlainText(((SimpleScalar) arguments.get(0)).getAsString())); +===================================================================== +Found a 4 line (48 tokens) duplication in the following files: +Starting at line 92 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptManagementService.java +Starting at line 494 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java + + conceptIds.addAll(instruments.stream() + .map(instrument -> instrument.getConceptIds() != null ? instrument.getConceptIds() + : new ArrayList()) + .flatMap(List::stream).collect(Collectors.toSet())); +===================================================================== +Found a 4 line (48 tokens) duplication in the following files: +Starting at line 99 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptManagementService.java +Starting at line 145 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptManagementService.java +Starting at line 186 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptManagementService.java +Starting at line 210 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptManagementService.java +Starting at line 498 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java + + conceptIds.addAll(questionRepository.findSubDocumentsByInstrumentIdIn(instrumentIds).stream() + .map(question -> question.getConceptIds() != null ? question.getConceptIds() + : new ArrayList()) + .flatMap(List::stream).collect(Collectors.toSet())); +===================================================================== +Found a 11 line (48 tokens) duplication in the following files: +Starting at line 68 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/repository/DataPackageRepository.java +Starting at line 82 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/repository/DataSetRepository.java + + Stream streamByDataAcquisitionProjectIdAndShadowIsTrue(String oldProjectId); + + @RestResource(exported = false) + Stream streamIdsByMasterIdInAndShadowIsTrueAndSuccessorIdIsNull( + Collection dataSetIds); + + @RestResource(exported = false) + Stream streamIdsByMasterIdIn(Collection dataSetIds); + + @RestResource(exported = false) + Stream findByDataAcquisitionProjectIdAndShadowIsTrue( +===================================================================== +Found a 7 line (48 tokens) duplication in the following files: +Starting at line 35 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/helper/DataPackageAttachmentShadowCopyDataSource.java +Starting at line 35 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/helper/DataSetAttachmentShadowCopyDataSource.java +Starting at line 35 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/helper/InstrumentAttachmentShadowCopyDataSource.java +Starting at line 37 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/helper/QuestionImageShadowCopyDataSource.java +Starting at line 35 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/helper/SurveyAttachmentShadowCopyDataSource.java +Starting at line 37 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/helper/SurveyResponseRateImageShadowCopyDataSource.java + + public DataPackageAttachmentMetadata createShadowCopy(DataPackageAttachmentMetadata source, + Release release) { + + String derivedId = deriveId(source, release.getVersion()); + + Query query = new Query(GridFsCriteria.whereMetaData("_id").is(derivedId)); + GridFSFile gridFsFile = this.gridFsOperations.findOne(query); +===================================================================== +Found a 3 line (48 tokens) duplication in the following files: +Starting at line 45 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/helper/DataSetShadowCopyDataSource.java +Starting at line 46 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/helper/InstrumentShadowCopyDataSource.java +Starting at line 49 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/helper/VariableShadowCopyDataSource.java + + source.getDataAcquisitionProjectId() + "-" + release.getVersion()); + copy.setDataPackageId(source.getDataPackageId() + "-" + release.getVersion()); + copy.setSurveyIds(createDerivedSurveyIds(source.getSurveyIds(), release.getVersion())); +===================================================================== +Found a 8 line (48 tokens) duplication in the following files: +Starting at line 38 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/repository/ElasticsearchUpdateQueueItemRepositoryImpl.java +Starting at line 60 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/repository/ElasticsearchUpdateQueueItemRepositoryImpl.java + + Query query = new Query(getUnlockedOrExpiredCriteria()).limit(BULK_SIZE); + Update update = new Update() + .set("updateStartedAt", updateStartedAt).set("updateStartedBy", updateStartedBy); + mongoOperations.updateMulti(query, update, ElasticsearchUpdateQueueItem.class); + } + + @Override + public List findOldestLockedItems(String updateStartedBy, +===================================================================== +Found a 8 line (48 tokens) duplication in the following files: +Starting at line 310 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 392 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 645 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java + + questions, instruments, surveys, dataSets, variables); + + request.add(new IndexRequest(lockedItem.getDocumentType().name()).id(searchDocument.getId()) + .source(gson.toJson(searchDocument), XContentType.JSON)); + return true; + } + return false; + } +===================================================================== +Found a 4 line (48 tokens) duplication in the following files: +Starting at line 330 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 422 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 498 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 535 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java + + Set conceptIds = questions.stream() + .map(question -> question.getConceptIds() != null ? question.getConceptIds() + : new ArrayList()) + .flatMap(List::stream).collect(Collectors.toSet()); +===================================================================== +Found a 8 line (48 tokens) duplication in the following files: +Starting at line 84 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 113 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 145 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 177 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 219 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 239 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 63 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentVersionsResourceTest.java + + .buildConceptAttachmentMetadata("con-conceptid$"); + MockMultipartFile metadata = new MockMultipartFile("conceptAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(conceptAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/concepts/attachments") + .file(attachment) + .file(metadata)) + .andExpect(status().isCreated()); +===================================================================== +Found a 7 line (48 tokens) duplication in the following files: +Starting at line 135 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 179 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 179 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 127 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 164 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + .perform(get("/api/concepts/" + conceptAttachmentMetadata.getConceptId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(0))); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER, username = "test") + public void testDeleteAllAttachments() throws Exception { +===================================================================== +Found a 7 line (48 tokens) duplication in the following files: +Starting at line 167 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 146 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 146 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 137 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + .perform(get("/api/concepts/" + conceptAttachmentMetadata.getConceptId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(0))); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER, username = "test") + public void updateAttachmentMetadata() throws Exception { +===================================================================== +Found a 7 line (48 tokens) duplication in the following files: +Starting at line 69 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentVersionsResourceTest.java +Starting at line 86 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentVersionsResourceTest.java + + .file(metadata)).andExpect(status().isCreated()); + + // assert that there is one initial version + mockMvc + .perform(get("/api/concepts/" + conceptAttachmentMetadata.getConceptId() + "/attachments/" + + conceptAttachmentMetadata.getFileName() + "/versions")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(1))); +===================================================================== +Found a 6 line (48 tokens) duplication in the following files: +Starting at line 94 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 123 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 156 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 189 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 237 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 256 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 281 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 308 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 63 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentVersionsResourceTest.java +Starting at line 75 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectAttachmentsResourceControllerTest.java + + UnitTestCreateDomainObjectUtils.buildDataPackageAttachmentMetadata("projectid"); + MockMultipartFile metadata = new MockMultipartFile("dataPackageAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(dataPackageAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/data-packages/attachments") + .file(attachment).file(metadata)).andExpect(status().isCreated()); +===================================================================== +Found a 8 line (48 tokens) duplication in the following files: +Starting at line 205 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 80 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentVersionsResourceTest.java + + current.setType(DataPackageAttachmentTypes.OTHER); + + // update the metadata + mockMvc.perform(put("/api/data-packages/" + dataPackageAttachmentMetadata.getDataPackageId() + + "/attachments/" + attachment.getOriginalFilename()) + .content(TestUtil.convertObjectToJsonBytes(current)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().is2xxSuccessful()); +===================================================================== +Found a 9 line (48 tokens) duplication in the following files: +Starting at line 337 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 261 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 276 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 338 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 336 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 310 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 359 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 316 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 398 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 890 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + .content(TestUtil.convertObjectToJsonBytes(metadata)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()).andExpect(jsonPath("$.errors[0].message", + containsString("global.error.shadow-save-not-allowed"))); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER) + public void testDeleteAllAttachmentsOfShadowCopyDataPackage() throws Exception { +===================================================================== +Found a 7 line (48 tokens) duplication in the following files: +Starting at line 69 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentVersionsResourceTest.java +Starting at line 87 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentVersionsResourceTest.java + + .file(metadata)).andExpect(status().isCreated()); + + // assert that there is one initial version + mockMvc + .perform(get("/api/data-packages/" + dataPackageAttachmentMetadata.getDataPackageId() + + "/attachments/" + dataPackageAttachmentMetadata.getFileName() + "/versions")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(1))); +===================================================================== +Found a 8 line (48 tokens) duplication in the following files: +Starting at line 95 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 124 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 157 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 189 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 233 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 253 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 281 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 310 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 63 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentVersionsResourceTest.java + + .buildDataSetAttachmentMetadata("projectid", 1); + MockMultipartFile metadata = new MockMultipartFile("dataSetAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(dataSetAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/data-sets/attachments") + .file(attachment) + .file(metadata)) + .andExpect(status().isCreated()); +===================================================================== +Found a 7 line (48 tokens) duplication in the following files: +Starting at line 69 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentVersionsResourceTest.java +Starting at line 86 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentVersionsResourceTest.java + + .file(metadata)).andExpect(status().isCreated()); + + // assert that there is one initial version + mockMvc + .perform(get("/api/data-sets/" + dataSetAttachmentMetadata.getDataSetId() + "/attachments/" + + dataSetAttachmentMetadata.getFileName() + "/versions")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(1))); +===================================================================== +Found a 9 line (48 tokens) duplication in the following files: +Starting at line 321 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 296 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 345 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 384 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 874 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + .content(TestUtil.convertObjectToJsonBytes(dataSet)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) + .andExpect(jsonPath("$.errors[0].message", containsString("global.error.shadow-create-not-allowed"))); + } + + @Test + @WithMockUser(authorities=AuthoritiesConstants.PUBLISHER) + public void testUpdateShadowCopyDataSet() throws Exception { +===================================================================== +Found a 8 line (48 tokens) duplication in the following files: +Starting at line 114 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java +Starting at line 145 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java + + public void createShadowCopyWithSameReleaseVersion() throws Exception { + DataSetAttachmentMetadata master = + UnitTestCreateDomainObjectUtils.buildDataSetAttachmentMetadata(PROJECT_ID, 1); + master.generateId(); + master.setMasterId(master.getId()); + createTestFileForAttachment(master); + DataSetAttachmentMetadata shadow = createShadow(master, "1.0.0"); + createTestFileForAttachment(shadow); +===================================================================== +Found a 6 line (48 tokens) duplication in the following files: +Starting at line 79 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 105 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 137 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 181 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 215 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 234 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 63 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentVersionsResourceTest.java +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectAttachmentsResourceControllerTest.java + + UnitTestCreateDomainObjectUtils.buildInstrumentAttachmentMetadata("projectid", 1); + MockMultipartFile metadata = new MockMultipartFile("instrumentAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(instrumentAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/instruments/attachments") + .file(attachment).file(metadata)).andExpect(status().isCreated()); +===================================================================== +Found a 7 line (48 tokens) duplication in the following files: +Starting at line 69 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentVersionsResourceTest.java +Starting at line 86 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentVersionsResourceTest.java + + .file(metadata)).andExpect(status().isCreated()); + + // assert that there is one initial version + mockMvc + .perform(get("/api/instruments/" + instrumentAttachmentMetadata.getInstrumentId() + + "/attachments/" + instrumentAttachmentMetadata.getFileName() + "/versions")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(1))); +===================================================================== +Found a 8 line (48 tokens) duplication in the following files: +Starting at line 114 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java +Starting at line 148 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java + + public void createShadowCopyWithSameReleaseVersion() throws Exception { + InstrumentAttachmentMetadata master = + UnitTestCreateDomainObjectUtils.buildInstrumentAttachmentMetadata(PROJECT_ID, 1); + master.generateId(); + master.setMasterId(master.getId()); + createTestFileForAttachment(master); + InstrumentAttachmentMetadata shadow = createShadow(master, "1.0.0"); + createTestFileForAttachment(shadow); +===================================================================== +Found a 7 line (48 tokens) duplication in the following files: +Starting at line 173 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 201 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 101 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + + // create the project with the given id + mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isCreated()); + project.setVersion(0L); +===================================================================== +Found a 7 line (48 tokens) duplication in the following files: +Starting at line 200 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 106 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + project.setHasBeenReleasedBefore(true); + + // create the project with the given id + mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isCreated()); +===================================================================== +Found a 5 line (48 tokens) duplication in the following files: +Starting at line 189 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResourceTest.java +Starting at line 145 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + + this.mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isCreated()); +===================================================================== +Found a 4 line (48 tokens) duplication in the following files: +Starting at line 201 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResourceTest.java +Starting at line 212 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResourceTest.java +Starting at line 158 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 168 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 179 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + + project.getRelease().setVersion(version);; + this.mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isNoContent()); +===================================================================== +Found a 8 line (48 tokens) duplication in the following files: +Starting at line 83 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionImageResourceTest.java +Starting at line 104 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionImageResourceTest.java +Starting at line 123 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionImageResourceTest.java + + UnitTestCreateDomainObjectUtils.buildQuestionImageMetadata("projectid", "questionid"); + MockMultipartFile metadata = new MockMultipartFile("questionImageMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(questionImageMetadata)); + + mockMvc + .perform(MockMvcRequestBuilders.multipart("/api/questions/images").file(attachment) + .file(metadata)) + .andExpect(status().isCreated()); +===================================================================== +Found a 8 line (48 tokens) duplication in the following files: +Starting at line 115 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionImageShadowCopyServiceTest.java +Starting at line 146 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionImageShadowCopyServiceTest.java + + public void createShadowCopyWithSameReleaseVersion() throws Exception { + QuestionImageMetadata master = + UnitTestCreateDomainObjectUtils.buildQuestionImageMetadata(PROJECT_ID, QUESTION_ID); + master.generateId(); + master.setMasterId(master.getId()); + createTestFileForAttachment(master); + QuestionImageMetadata shadow = createShadow(master, "1.0.0"); + createTestFileForAttachment(shadow); +===================================================================== +Found a 8 line (48 tokens) duplication in the following files: +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 115 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 200 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 235 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 264 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java + + public void testCreateRelatedPublications() throws IOException, Exception { + // ARRANGE + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + DataPackage dataPackage = UnitTestCreateDomainObjectUtils.buildDataPackage(project.getId()); + dataPackageRepository.save(dataPackage); + RelatedPublication relatedPublication = + UnitTestCreateDomainObjectUtils.buildRelatedPublication(); +===================================================================== +Found a 8 line (48 tokens) duplication in the following files: +Starting at line 148 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 168 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 188 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 282 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java + + UnitTestCreateDomainObjectUtils.buildRelatedPublication(null, 2017); + + // ACT + this.mockMvc + .perform(put(API_RELATED_PUBLICATION_URI + "/" + relatedPublication.getId()) + .content(TestUtil.convertObjectToJsonBytes(relatedPublication)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) +===================================================================== +Found a 8 line (48 tokens) duplication in the following files: +Starting at line 93 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 120 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 147 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 174 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 213 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 233 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 260 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 289 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 63 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentVersionsResourceTest.java + + .buildSurveyAttachmentMetadata("projectid", 1); + MockMultipartFile metadata = new MockMultipartFile("surveyAttachmentMetadata", "Blob", + "application/json", TestUtil.convertObjectToJsonBytes(surveyAttachmentMetadata)); + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/surveys/attachments") + .file(attachment) + .file(metadata)) + .andExpect(status().isCreated()); +===================================================================== +Found a 7 line (48 tokens) duplication in the following files: +Starting at line 68 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentVersionsResourceTest.java +Starting at line 84 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentVersionsResourceTest.java + + .file(metadata)).andExpect(status().isCreated()); + + // assert that there is one initial version + mockMvc + .perform(get("/api/surveys/" + surveyAttachmentMetadata.getSurveyId() + "/attachments/" + + surveyAttachmentMetadata.getFileName() + "/versions")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(1))); +===================================================================== +Found a 6 line (48 tokens) duplication in the following files: +Starting at line 189 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 327 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 355 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 477 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 513 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 686 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 746 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + variable.setScaleLevel(null); + + // create the variable with a survey but without a project + mockMvc.perform(put(API_VARIABLES_URI + "/" + variable.getId()) + .content(TestUtil.convertObjectToJsonBytes(variable)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isBadRequest()); +===================================================================== +Found a 8 line (48 tokens) duplication in the following files: +Starting at line 334 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 460 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 495 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 553 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + variable.setLabel(new I18nString()); + + // create the variable with an empty label + mockMvc + .perform(put(API_VARIABLES_URI + "/" + variable.getId()) + .content(TestUtil.convertObjectToJsonBytes(variable)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()).andExpect(jsonPath("$.errors[0].message", +===================================================================== +Found a 16 line (48 tokens) duplication in the following files: +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptNestedDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageNestedDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationNestedDocument.java + + public static final QConceptNestedDocument conceptNestedDocument = new QConceptNestedDocument("conceptNestedDocument"); + + public final QAbstractNestedSubDocument _super; + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString completeTitle; + + //inherited + public final StringPath createdBy; + + //inherited + public final DateTimePath createdDate; + + public final StringPath id = createString("id"); + + //inherited + public final StringPath lastModifiedBy; +===================================================================== +Found a 5 line (48 tokens) duplication in the following files: +Starting at line 43 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 53 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 58 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 51 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java + + public final ListPath dataSets = this.createList("dataSets", DataSetSubDocument.class, QDataSetSubDocument.class, PathInits.DIRECT2); + + // custom + // inherited + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString description = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(_super.description); +===================================================================== +Found a 15 line (48 tokens) duplication in the following files: +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionNestedDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveyNestedDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableNestedDocument.java + + public static final QQuestionNestedDocument questionNestedDocument = new QQuestionNestedDocument("questionNestedDocument"); + + public final QAbstractNestedSubDocument _super; + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString completeTitle; + + //inherited + public final StringPath createdBy; + + //inherited + public final DateTimePath createdDate; + + public final StringPath dataPackageId = createString("dataPackageId"); + + public final StringPath id = createString("id"); +===================================================================== +Found a 8 line (48 tokens) duplication in the following files: +Starting at line 120 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java +Starting at line 73 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QSurvey.java + + public final BooleanPath shadow = _super.shadow; + + //inherited + public final StringPath successorId = _super.successorId; + + // custom + // inherited + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString surveyMethod = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(_super.surveyMethod); +===================================================================== +Found a 4 line (47 tokens) duplication in the following files: +Starting at line 99 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptManagementService.java +Starting at line 145 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptManagementService.java +Starting at line 186 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptManagementService.java +Starting at line 210 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptManagementService.java +Starting at line 330 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 422 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 535 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java + + conceptIds.addAll(questionRepository.findSubDocumentsByInstrumentIdIn(instrumentIds).stream() + .map(question -> question.getConceptIds() != null ? question.getConceptIds() + : new ArrayList()) + .flatMap(List::stream).collect(Collectors.toSet())); +===================================================================== +Found a 15 line (47 tokens) duplication in the following files: +Starting at line 136 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetManagementService.java +Starting at line 153 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetManagementService.java + + variableRepository.streamIdsByRelatedQuestionsQuestionId(question.getId()) + .map(variable -> variable.getDataSetId()).collect(Collectors.toSet()); + return dataSetRepository.streamIdsByIdIn(dataSetIds); + }, ElasticsearchType.data_sets); + } + + /** + * Enqueue update of data set search documents when the instrument is updated. + * + * @param instrument the updated, created or deleted instrument. + */ + @HandleAfterCreate + @HandleAfterSave + @HandleAfterDelete + public void onInstrumentChanged(Instrument instrument) { +===================================================================== +Found a 6 line (47 tokens) duplication in the following files: +Starting at line 87 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 127 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 154 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 69 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java + + Concept concept = UnitTestCreateDomainObjectUtils.buildConcept(); + + // create the concept with the given id + mockMvc.perform(put(API_CONCEPT_URI + "/" + concept.getId()) + .content(TestUtil.convertObjectToJsonBytes(concept)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); +===================================================================== +Found a 4 line (47 tokens) duplication in the following files: +Starting at line 98 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java +Starting at line 105 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java + + concept.setTitle(new I18nString("hurzDe2", "hurzEn2")); + mockMvc.perform(put(API_CONCEPT_URI + "/" + concept.getId()) + .content(TestUtil.convertObjectToJsonBytes(concept)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isNoContent()); +===================================================================== +Found a 4 line (47 tokens) duplication in the following files: +Starting at line 113 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 120 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java + + dataPackage.setTitle(new I18nString("hurzDe2", "hurzEn2")); + mockMvc.perform(put(API_DATAPACKAGE_URI + "/" + dataPackage.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataPackage)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isNoContent()); +===================================================================== +Found a 7 line (47 tokens) duplication in the following files: +Starting at line 107 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageShadowCopyServiceTest.java +Starting at line 113 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetShadowCopyServiceTest.java +Starting at line 107 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentShadowCopyServiceTest.java +Starting at line 98 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/service/DataAcquisitionProjectShadowCopyServiceTest.java +Starting at line 114 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionShadowCopyServiceTest.java +Starting at line 111 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyShadowCopyServiceTest.java +Starting at line 108 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/VariableShadowCopyServiceTest.java + + Optional persistedShadow = dataPackageRepository.findById(shadow.getId()); + assertThat(persistedShadow.isPresent(), equalTo(true)); + assertThat(persistedShadow.get().getSuccessorId(), nullValue()); + } + + @Test + public void createShadowCopyLinkPredecessorToSuccessor() { +===================================================================== +Found a 9 line (47 tokens) duplication in the following files: +Starting at line 114 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 96 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java + + .andExpect(jsonPath("$.[0].masterId", is(dataSetAttachmentMetadata.getId()))); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER, username = "test") + public void testDeleteSingleAttachment() throws Exception { + + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); +===================================================================== +Found a 6 line (47 tokens) duplication in the following files: +Starting at line 76 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java +Starting at line 100 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java +Starting at line 39 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/CopyPropertiesTest.java + + public void testCreateDataSetAndReadVersions() throws IOException, Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); + DataSet dataSet = UnitTestCreateDomainObjectUtils.buildDataSet(project.getId(), survey.getId(), +===================================================================== +Found a 6 line (47 tokens) duplication in the following files: +Starting at line 118 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java +Starting at line 127 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java + + dataSet.setDescription(new I18nString("hurzDe2", "hurzEn2")); + mockMvc + .perform(put(API_DATASET_URI + "/" + dataSet.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataSet)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isNoContent()); +===================================================================== +Found a 6 line (47 tokens) duplication in the following files: +Starting at line 113 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 122 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java + + instrument.setTitle(new I18nString("hurzDe2", "hurzEn2")); + mockMvc + .perform(put(API_INSTRUMENT_URI + "/" + instrument.getId()) + .content(TestUtil.convertObjectToJsonBytes(instrument)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isNoContent()); +===================================================================== +Found a 6 line (47 tokens) duplication in the following files: +Starting at line 113 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DaraServiceTest.java +Starting at line 183 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 242 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 304 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java + + dataAcquisitionProjectRepository.save(project); + DataPackage dataPackage = UnitTestCreateDomainObjectUtils.buildDataPackage(project.getId()); + this.dataPackageRepository.save(dataPackage); + + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); + this.surveyRepository.save(survey); +===================================================================== +Found a 6 line (47 tokens) duplication in the following files: +Starting at line 204 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 147 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + + mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isCreated()); + + // update the project + project.setHasBeenReleasedBefore(false); +===================================================================== +Found a 6 line (47 tokens) duplication in the following files: +Starting at line 386 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 482 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java + + rdcProjectRepository.save(project); + + mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .content(TestUtil.convertObjectToJsonBytes(project)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isNoContent()); +===================================================================== +Found a 8 line (47 tokens) duplication in the following files: +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 115 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 141 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 161 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 200 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 235 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 264 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java + + public void testCreateRelatedPublications() throws IOException, Exception { + // ARRANGE + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + DataPackage dataPackage = UnitTestCreateDomainObjectUtils.buildDataPackage(project.getId()); + dataPackageRepository.save(dataPackage); + RelatedPublication relatedPublication = + UnitTestCreateDomainObjectUtils.buildRelatedPublication(); +===================================================================== +Found a 7 line (47 tokens) duplication in the following files: +Starting at line 136 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 151 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 174 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 395 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + survey.setDataType(I18nString.builder().de("Mixed Methods").en("Mixed Methods").build()); + + // create the survey with the given id but with wrong period + mockMvc.perform(put(API_SURVEYS_URI + "/" + survey.getId()) + .content(TestUtil.convertObjectToJsonBytes(survey)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) + .andReturn(); +===================================================================== +Found a 10 line (47 tokens) duplication in the following files: +Starting at line 147 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResponseRateImageResourceTest.java +Starting at line 176 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResponseRateImageResourceTest.java + + delete("/api/surveys/" + surveyResponseRateImageMetadata.getSurveyId() + "/images")) + .andExpect(status().isNoContent()); + + // assert that the file does not exist anymore + mockMvc.perform(get(fileUri)).andExpect(status().isNotFound()); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER) + public void testDeleteSingleResponseRateImage() throws Exception { +===================================================================== +Found a 4 line (47 tokens) duplication in the following files: +Starting at line 109 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java +Starting at line 116 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java + + survey.setTitle(new I18nString("hurzDe2", "hurzEn2")); + mockMvc.perform(put(API_SURVEY_URI + "/" + survey.getId()) + .content(TestUtil.convertObjectToJsonBytes(survey)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isNoContent()); +===================================================================== +Found a 6 line (47 tokens) duplication in the following files: +Starting at line 460 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 495 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 619 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + variable.setScaleLevel(I18nString.builder().de("InvalidValue").en("InvalidValue").build()); + + // create the variable with a survey but without a project + mockMvc.perform(put(API_VARIABLES_URI + "/" + variable.getId()) + .content(TestUtil.convertObjectToJsonBytes(variable)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isBadRequest()); +===================================================================== +Found a 15 line (47 tokens) duplication in the following files: +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetNestedDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentNestedDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionNestedDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveyNestedDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableNestedDocument.java + + public static final QDataSetNestedDocument dataSetNestedDocument = new QDataSetNestedDocument("dataSetNestedDocument"); + + public final QAbstractNestedSubDocument _super; + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString completeTitle; + + //inherited + public final StringPath createdBy; + + //inherited + public final DateTimePath createdDate; + + public final StringPath dataPackageId = createString("dataPackageId"); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString description; +===================================================================== +Found a 6 line (47 tokens) duplication in the following files: +Starting at line 92 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java +Starting at line 91 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java + + public final ListPath nestedSurveys = this.createList("nestedSurveys", SurveyNestedDocument.class, QSurveyNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedVariables = this.createList("nestedVariables", VariableNestedDocument.class, QVariableNestedDocument.class, PathInits.DIRECT2); + + //inherited + public final NumberPath number; +===================================================================== +Found a 9 line (46 tokens) duplication in the following files: +Starting at line 146 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageOverviewResource.java +Starting at line 141 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetReportResource.java + + mailService.sendDataPackageOverviewGeneratedMail(user.get(), dataPackageId, language, sender); + SecurityContextHolder.getContext().setAuthentication(null); + return ResponseEntity.ok().build(); + } else { + return ResponseEntity.badRequest() + .body("User with name '" + onBehalfOf + "' does not exist!"); + } + } +} +===================================================================== +Found a 16 line (46 tokens) duplication in the following files: +Starting at line 97 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentService.java +Starting at line 100 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentService.java +Starting at line 93 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentService.java +Starting at line 80 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentService.java + + .read(DataPackageAttachmentMetadata.class, file.getMetadata()); + if (metadata.isShadow()) { + throw new ShadowCopyDeleteNotAllowedException(); + } + javers.commitShallowDelete(currentUser, metadata); + }); + this.operations.delete(query); + } + + /** + * Load all metadata objects from gridfs (ordered by indexInDataPackage). + * + * @param dataPackageId The id of the dataPackage. + * @return A list of metadata. + */ + public List findAllByDataPackage(String dataPackageId) { +===================================================================== +Found a 4 line (46 tokens) duplication in the following files: +Starting at line 114 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentService.java +Starting at line 134 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentService.java + + + Pattern.quote(DataPackageAttachmentFilenameBuilder.buildFileNamePrefix(dataPackageId)))); + query.with(Sort.by(Sort.Direction.ASC, "metadata.indexInDataPackage")); + Iterable files = this.operations.find(query); + List result = new ArrayList<>(); +===================================================================== +Found a 8 line (46 tokens) duplication in the following files: +Starting at line 472 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 542 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 635 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java + + projectRepository.findById(survey.getDataAcquisitionProjectId()).orElse(null); + if (project == null) { + // project has been deleted, skip upsert + return false; + } + Release release = getRelease(project); + Configuration configuration = project.getConfiguration(); + String doi = doiBuilder.buildDataPackageDoi(dataPackage, release); +===================================================================== +Found a 24 line (46 tokens) duplication in the following files: +Starting at line 16 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/validation/ValidDataTypeValidator.java +Starting at line 16 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/ValidDataTypeValidator.java + +public class ValidDataTypeValidator implements ConstraintValidator { + + /* + * (non-Javadoc) + * + * @see javax.validation.ConstraintValidator#initialize(java.lang.annotation.Annotation) + */ + @Override + public void initialize(ValidDataType constraintAnnotation) {} + + /* + * (non-Javadoc) + * + * @see javax.validation.ConstraintValidator#isValid(java.lang.Object, + * javax.validation.ConstraintValidatorContext) + */ + @Override + public boolean isValid(I18nString dataType, ConstraintValidatorContext context) { + + // check for data types + return DataTypes.ALL.contains(dataType); + } + +} +===================================================================== +Found a 8 line (46 tokens) duplication in the following files: +Starting at line 197 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 83 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentVersionsResourceTest.java +Starting at line 83 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentVersionsResourceTest.java +Starting at line 209 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 83 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentVersionsResourceTest.java +Starting at line 156 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 83 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentVersionsResourceTest.java +Starting at line 191 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 81 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentVersionsResourceTest.java + + .perform(put("/api/concepts/" + conceptAttachmentMetadata.getConceptId() + "/attachments/" + + attachment.getOriginalFilename()).content(TestUtil.convertObjectToJsonBytes(current)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isNoContent()); + + // read the updated attachment and check the version + mockMvc + .perform(get("/api/concepts/" + conceptAttachmentMetadata.getConceptId() + "/attachments")) +===================================================================== +Found a 4 line (46 tokens) duplication in the following files: +Starting at line 205 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 220 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 218 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 168 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 199 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + .andExpect(status().isOk()).andExpect(jsonPath("$.[0].version", is(1))) + .andExpect(jsonPath("$.[0].createdBy", is("test"))) + .andExpect(jsonPath("$.[0].lastModifiedBy", is("test"))) + .andExpect(jsonPath("$.[0].language", is("en"))); +===================================================================== +Found a 7 line (46 tokens) duplication in the following files: +Starting at line 141 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 174 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 211 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java + + + "/attachments/" + attachment.getOriginalFilename())) + .andExpect(status().is2xxSuccessful()); + + // ensure the uploaded file does not exist anymore + mockMvc.perform(get( + "/api/data-packages/" + dataPackageAttachmentMetadata.getDataPackageId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(0))); +===================================================================== +Found a 6 line (46 tokens) duplication in the following files: +Starting at line 200 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 74 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentVersionsResourceTest.java + + "/api/data-packages/" + dataPackageAttachmentMetadata.getDataPackageId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(1))); + + DataPackageAttachmentMetadata current = dataPackageAttachmentService + .findAllByDataPackage(dataPackageAttachmentMetadata.getDataPackageId()).get(0); + current.setType(DataPackageAttachmentTypes.OTHER); +===================================================================== +Found a 9 line (46 tokens) duplication in the following files: +Starting at line 327 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 371 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java + + metadata.setVersion(0L); + + String filename = DataPackageAttachmentFilenameBuilder.buildFileName(metadata); + try (InputStream is = new ByteArrayInputStream("Test".getBytes(StandardCharsets.UTF_8))) { + gridFsMetadataUpdateService.store(is, filename, "text/plain", metadata); + } + + mockMvc + .perform( +===================================================================== +Found a 6 line (46 tokens) duplication in the following files: +Starting at line 118 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 140 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 170 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 196 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 93 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 190 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 221 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 79 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 104 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java + + DataPackage dataPackage = UnitTestCreateDomainObjectUtils.buildDataPackage(project.getId()); + + // create the dataPackage with the given id + mockMvc.perform(put(API_DATAPACKAGE_URI + "/" + dataPackage.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataPackage)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); +===================================================================== +Found a 16 line (46 tokens) duplication in the following files: +Starting at line 43 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DeleteAllDataPackagesResourceControllerTest.java +Starting at line 43 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/AvailableDataSetNumbersResourceControllerTest.java +Starting at line 44 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DeleteAllDateSetsResourceControllerTest.java +Starting at line 38 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/AvailableInstrumentNumbersResourceControllerTest.java +Starting at line 47 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/DeleteAllInstrumentsResourceControllerTest.java +Starting at line 41 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/DeleteAllQuestionsResourceControllerTest.java +Starting at line 38 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/AvailableSurveyNumbersResourceControllerTest.java +Starting at line 45 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/DeleteAllSurveysResourceControllerTest.java +Starting at line 44 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/DeleteAllVariablesResourceControllerTest.java + + @Autowired + private ElasticsearchUpdateQueueItemRepository elasticsearchUpdateQueueItemRepository; + + @Autowired + private ElasticsearchAdminService elasticsearchAdminService; + + @Autowired + private JaversService javersService; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac).build(); + } + + @After + public void cleanUp() { +===================================================================== +Found a 8 line (46 tokens) duplication in the following files: +Starting at line 114 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java +Starting at line 145 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java + + public void createShadowCopyWithSameReleaseVersion() throws Exception { + DataPackageAttachmentMetadata master = + UnitTestCreateDomainObjectUtils.buildDataPackageAttachmentMetadata(PROJECT_ID); + master.generateId(); + master.setMasterId(master.getId()); + createTestFileForAttachment(master); + DataPackageAttachmentMetadata shadow = createShadow(master, "1.0.0"); + createTestFileForAttachment(shadow); +===================================================================== +Found a 6 line (46 tokens) duplication in the following files: +Starting at line 124 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java +Starting at line 121 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java +Starting at line 172 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyResponseRateImageShadowCopyServiceTest.java + + dataAcquisitionProject.getRelease(), "1.0.0"); + + List files = new ArrayList<>(); + gridFsOperations.find(new Query()).iterator().forEachRemaining(files::add); + + assertThat(files.size(), equalTo(2)); +===================================================================== +Found a 8 line (46 tokens) duplication in the following files: +Starting at line 330 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 372 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java + + metadata.setVersion(0L); + + String filename = DataSetAttachmentFilenameBuilder.buildFileName(metadata); + try (InputStream is = new ByteArrayInputStream("Test".getBytes(StandardCharsets.UTF_8))) { + gridFsMetadataUpdateService.store(is, filename, "text/plain", metadata); + } + + mockMvc.perform(put("/api/data-sets/" + dataSetId + "/attachments/" + metadata.getFileName()) +===================================================================== +Found a 17 line (46 tokens) duplication in the following files: +Starting at line 68 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 50 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 65 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java + + @Autowired + private ElasticsearchAdminService elasticsearchAdminService; + + @Autowired + private JaversService javersService; + + private MockMvc mockMvc; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac) + .build(); + } + + @After + public void cleanUp() { + this.dataAcquisitionProjectRepository.deleteAll(); +===================================================================== +Found a 8 line (46 tokens) duplication in the following files: +Starting at line 165 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 184 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 200 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 333 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java + + DataSet dataSet = UnitTestCreateDomainObjectUtils.buildDataSet(null, survey.getId(), 1); + + + // Act and Assert + // create the DataSet with a survey but without a project + mockMvc.perform(put(API_DATASETS_URI + "/" + dataSet.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataSet)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()); +===================================================================== +Found a 7 line (46 tokens) duplication in the following files: +Starting at line 215 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 239 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 294 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java + + DataSet dataSet = UnitTestCreateDomainObjectUtils.buildDataSet(project.getId(), "notExist", null); + + // Act and Assert + // create the DataSet with the given id but with an unknown survey + mockMvc.perform(put(API_DATASETS_URI + "/" + dataSet.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataSet)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().is2xxSuccessful()); +===================================================================== +Found a 8 line (46 tokens) duplication in the following files: +Starting at line 82 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java +Starting at line 107 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java + + survey.getNumber()); + + // create the data set with the given id + mockMvc + .perform(put(API_DATASET_URI + "/" + dataSet.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataSet)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 6 line (46 tokens) duplication in the following files: +Starting at line 72 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/DeleteAllInstrumentsResourceControllerTest.java +Starting at line 68 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/DeleteAllVariablesResourceControllerTest.java + + public void testDeleteAllInstrumentsOfProject() throws Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + String projectId = project.getId(); + List surveyNumbers = new ArrayList(); + surveyNumbers.add(1); +===================================================================== +Found a 7 line (46 tokens) duplication in the following files: +Starting at line 147 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 74 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentVersionsResourceTest.java + + "/api/instruments/" + instrumentAttachmentMetadata.getInstrumentId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(1))); + + // update the metadata + InstrumentAttachmentMetadata current = instrumentAttachmentService + .findAllByInstrument(instrumentAttachmentMetadata.getInstrumentId()).get(0); + current.setType(InstrumentAttachmentTypes.OTHER); +===================================================================== +Found a 12 line (46 tokens) duplication in the following files: +Starting at line 83 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 117 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 146 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 186 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 262 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java + + public void testCreateInstrument() throws Exception { + + // Arrange + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + this.dataAcquisitionProjectRepository.save(project); + + Instrument instrument = + UnitTestCreateDomainObjectUtils.buildInstrument(project.getId(), project.getId() + "-sy1"); + + // Act and Assert + // create the instrument with the given id + mockMvc.perform(put(API_INSTRUMENTS_URI + "/" + instrument.getId()) +===================================================================== +Found a 8 line (46 tokens) duplication in the following files: +Starting at line 79 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 102 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java + + Instrument instrument = UnitTestCreateDomainObjectUtils.buildInstrument(project.getId()); + + // create the instrument with the given id + mockMvc + .perform(put(API_INSTRUMENT_URI + "/" + instrument.getId()) + .content(TestUtil.convertObjectToJsonBytes(instrument)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 5 line (46 tokens) duplication in the following files: +Starting at line 87 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 155 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 201 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 79 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + // create the project with the given id + mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isCreated()); +===================================================================== +Found a 5 line (46 tokens) duplication in the following files: +Starting at line 106 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 157 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java + + mockMvc.perform(post(API_DATA_ACQUISITION_PROJECTS_URI).contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isCreated()); + + // read the project under the new url + mockMvc.perform(get(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId())) +===================================================================== +Found a 7 line (46 tokens) duplication in the following files: +Starting at line 121 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 209 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java + + project.setMasterId("thisidistoolongandshouldproduceanerror"); + // create the project with the given id + mockMvc + .perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))) + .andExpect(status().is4xxClientError()).andExpect(jsonPath("$.errors[0].message", +===================================================================== +Found a 6 line (46 tokens) duplication in the following files: +Starting at line 137 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 173 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 101 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isNotFound()); + + // create the project with the given id + mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isCreated()); +===================================================================== +Found a 6 line (46 tokens) duplication in the following files: +Starting at line 335 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 347 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 358 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 366 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java + + project.setConfiguration(invalidConf); + mockMvc + .perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))) + .andExpect(status().isBadRequest()); +===================================================================== +Found a 6 line (46 tokens) duplication in the following files: +Starting at line 407 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 456 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 482 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java + + project.getConfiguration().getRequirements().setDataSetsRequired(true); + + mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .content(TestUtil.convertObjectToJsonBytes(project)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()); +===================================================================== +Found a 4 line (46 tokens) duplication in the following files: +Starting at line 109 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 116 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + + project.setHasBeenReleasedBefore(true); + mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isNoContent()); +===================================================================== +Found a 7 line (46 tokens) duplication in the following files: +Starting at line 267 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 284 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 301 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 356 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java + + question.setType(null); + + // Act and Assert + // create the variable with the given id + mockMvc.perform(put(API_QUESTIONS_URI + "/" + question.getId()) + .content(TestUtil.convertObjectToJsonBytes(question)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()); +===================================================================== +Found a 8 line (46 tokens) duplication in the following files: +Starting at line 308 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 350 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + metadata.setVersion(0L); + + String filename = SurveyAttachmentFilenameBuilder.buildFileName(metadata); + try (InputStream is = new ByteArrayInputStream("Test".getBytes(StandardCharsets.UTF_8))) { + gridFsMetadataUpdateService.store(is, filename, "text/plain", metadata); + } + + mockMvc.perform(put("/api/surveys/" + surveyId + "/attachments/" + metadata.getFileName()) +===================================================================== +Found a 6 line (46 tokens) duplication in the following files: +Starting at line 136 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 212 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 231 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + survey.setDataType(I18nString.builder().de("Mixed Methods").en("Mixed Methods").build()); + + // create the survey with the given id but with wrong period + mockMvc.perform(put(API_SURVEYS_URI + "/" + survey.getId()) + .content(TestUtil.convertObjectToJsonBytes(survey)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) +===================================================================== +Found a 6 line (46 tokens) duplication in the following files: +Starting at line 151 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 174 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 191 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 395 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + survey.setDataType(null); + + // create the survey with the given id but with wrong period + mockMvc.perform(put(API_SURVEYS_URI + "/" + survey.getId()) + .content(TestUtil.convertObjectToJsonBytes(survey)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) +===================================================================== +Found a 6 line (46 tokens) duplication in the following files: +Starting at line 79 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java +Starting at line 100 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java + + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); + + // create the dataPackage with the given id + mockMvc.perform(put(API_SURVEY_URI + "/" + survey.getId()) + .content(TestUtil.convertObjectToJsonBytes(survey)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 11 line (46 tokens) duplication in the following files: +Starting at line 63 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java +Starting at line 59 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyResponseRateImageShadowCopyServiceTest.java + + dataAcquisitionProject.setRelease(release); + } + + @After + public void teardown() { + Query query = new Query(GridFsCriteria.whereFilename().regex("^/surveys*")); + this.gridFsOperations.delete(query); + } + + @Test + public void createShadowCopy() throws Exception { +===================================================================== +Found a 6 line (46 tokens) duplication in the following files: +Starting at line 321 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java +Starting at line 441 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java + + new HashSet<>(Arrays.asList(AuthoritiesConstants.USER)), false); + + restMvc.perform(post("/api/register").contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(u))).andExpect(status().isCreated()); + + Optional user = userRepository.findOneByLogin("joe"); +===================================================================== +Found a 6 line (46 tokens) duplication in the following files: +Starting at line 111 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 251 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 277 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 589 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 619 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 646 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 726 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 786 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 805 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "var1", 1, surveyNumbers); + + // create the variable with the given id + mockMvc.perform(put(API_VARIABLES_URI + "/" + variable.getId()) + .content(TestUtil.convertObjectToJsonBytes(variable)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); +===================================================================== +Found a 6 line (46 tokens) duplication in the following files: +Starting at line 171 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 589 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 646 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + UnitTestCreateDomainObjectUtils.buildVariable(null, 1, "var1", 1, surveyNumbers); + + // create the variable with a survey but without a project + mockMvc.perform(put(API_VARIABLES_URI + "/" + variable.getId()) + .content(TestUtil.convertObjectToJsonBytes(variable)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isBadRequest()); +===================================================================== +Found a 6 line (46 tokens) duplication in the following files: +Starting at line 171 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 189 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 207 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 225 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 305 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 327 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 334 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 355 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 384 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 416 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 460 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 477 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 495 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 513 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 534 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 553 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 571 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 686 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 706 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 746 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 766 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 886 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + UnitTestCreateDomainObjectUtils.buildVariable(null, 1, "var1", 1, surveyNumbers); + + // create the variable with a survey but without a project + mockMvc.perform(put(API_VARIABLES_URI + "/" + variable.getId()) + .content(TestUtil.convertObjectToJsonBytes(variable)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isBadRequest()); +===================================================================== +Found a 7 line (46 tokens) duplication in the following files: +Starting at line 36 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QSubDataSet.java + + public final ListPath dataCurators = this.createList("dataCurators", eu.dzhw.fdz.metadatamanagement.common.domain.Person.class, eu.dzhw.fdz.metadatamanagement.common.domain.QPerson.class, PathInits.DIRECT2); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString description = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("description")); + + //inherited + public final BooleanPath hidden = _super.hidden; +===================================================================== +Found a 8 line (46 tokens) duplication in the following files: +Starting at line 97 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 141 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 141 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 131 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString title = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(_super.title); + + public final ListPath variables = this.createList("variables", VariableSubDocument.class, QVariableSubDocument.class, PathInits.DIRECT2); + + //inherited + public final NumberPath version = _super.version; + + public QConceptSearchDocument(String variable) { +===================================================================== +Found a 5 line (46 tokens) duplication in the following files: +Starting at line 97 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 91 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java + + public final ListPath nestedSurveys = this.createList("nestedSurveys", SurveyNestedDocument.class, QSurveyNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedVariables = this.createList("nestedVariables", VariableNestedDocument.class, QVariableNestedDocument.class, PathInits.DIRECT2); + + public final NumberPath numberOfWaves = createNumber("numberOfWaves", Integer.class); +===================================================================== +Found a 6 line (45 tokens) duplication in the following files: +Starting at line 133 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/service/AbstractAttachmentShadowCopyDataSource.java +Starting at line 86 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/helper/QuestionImageShadowCopyDataSource.java +Starting at line 86 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/helper/SurveyResponseRateImageShadowCopyDataSource.java + + int index = masterId.lastIndexOf("/attachments/"); + StringBuilder builder = new StringBuilder(); + builder.append(masterId, 0, index).append("-").append(previousVersion) + .append(masterId.substring(index)); + return builder.toString(); + } +===================================================================== +Found a 16 line (45 tokens) duplication in the following files: +Starting at line 158 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentService.java +Starting at line 169 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentService.java +Starting at line 162 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentService.java + + .read(DataPackageAttachmentMetadata.class, file.getMetadata()); + if (metadata.isShadow()) { + throw new ShadowCopyDeleteNotAllowedException(); + } + javers.commitShallowDelete(currentUser, metadata); + }); + this.operations.delete(query); + } + + /** + * Delete the attachment and its metadata from gridfs. + * + * @param dataPackageId The id of the dataPackage. + * @param filename The filename of the attachment. + */ + public void deleteByDataPackageIdAndFilename(String dataPackageId, String filename) { +===================================================================== +Found a 12 line (45 tokens) duplication in the following files: +Starting at line 110 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/helper/DataPackageShadowCopyDataSource.java +Starting at line 117 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/helper/DataSetShadowCopyDataSource.java +Starting at line 119 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/helper/InstrumentShadowCopyDataSource.java +Starting at line 96 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/service/helper/DataAcquisitionProjectShadowCopyDataSource.java +Starting at line 120 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/helper/QuestionShadowCopyDataSource.java +Starting at line 110 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/helper/SurveyShadowCopyDataSource.java +Starting at line 151 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/helper/VariableShadowCopyDataSource.java + + dataPackages.forEach(shadow -> { + shadow.setHidden(hidden); + crudHelper.saveShadow(shadow); + }); + } + } + + @Override + public void unhideExistingShadowCopies(String projectId, String version) { + setHiddenState(projectId, version, false); + } +} +===================================================================== +Found a 8 line (45 tokens) duplication in the following files: +Starting at line 31 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/usermanagement/repository/OAuth2AccessTokenRepositoryImpl.java +Starting at line 29 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/usermanagement/repository/OAuth2RefreshTokenRepositoryImpl.java + + return mongoTemplate.findOne(query, OAuth2AuthenticationAccessToken.class); + } + + @Override + public boolean deleteByTokenId(final String tokenId) { + final Query query = Query.query(Criteria.where(ID).is(tokenId)); + final DeleteResult deleteResult = + mongoTemplate.remove(query, OAuth2AuthenticationAccessToken.class); +===================================================================== +Found a 13 line (45 tokens) duplication in the following files: +Starting at line 28 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/StatisticsFirstQuartileMustBeANumberOnNumericDataTypeValidator.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/StatisticsFirstQuartileMustBeAnIsoDateOnDateDataTypeValidator.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/StatisticsMaximumMustBeANumberOnNumericDataTypeValidator.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/StatisticsMaximumMustBeAnIsoDateOnDateDataTypeValidator.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/StatisticsMedianMustBeANumberOnNumericDataTypeValidator.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/StatisticsMedianMustBeAnIsoDateOnDateDataTypeValidator.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/StatisticsMinimumMustBeANumberOnNumericDataTypeValidator.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/StatisticsMinimumMustBeAnIsoDateOnDateDataTypeValidator.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/StatisticsThirdQuartileMustBeANumberOnNumericDataTypeValidator.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/StatisticsThirdQuartileMustBeAnIsoDateOnDateDataTypeValidator.java +Starting at line 29 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/ValidResponseValueMustBeANumberOnNumericDataTypeValidator.java +Starting at line 29 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/ValidResponseValueMustBeAnIsoDateOnDateDataTypeValidator.java + + StatisticsFirstQuartileMustBeANumberOnNumericDataType constraintAnnotation) {} + + /* + * (non-Javadoc) + * + * @see javax.validation.ConstraintValidator#isValid(java.lang.Object, + * javax.validation.ConstraintValidatorContext) + */ + @Override + public boolean isValid(Variable variable, ConstraintValidatorContext context) { + + if (variable == null || variable.getDataType() == null || variable.getDistribution() == null + || variable.getDistribution().getStatistics() == null +===================================================================== +Found a 4 line (45 tokens) duplication in the following files: +Starting at line 48 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/VariableChangesProvider.java +Starting at line 56 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/VariableChangesProvider.java + + if (oldDomainObjects.get(variableId) != null + && oldDomainObjects.get(variableId).getRelatedQuestions() != null) { + for (RelatedQuestion question : oldDomainObjects.get(variableId).getRelatedQuestions()) { + if (!oldIds.contains(question.getInstrumentId())) { +===================================================================== +Found a 8 line (45 tokens) duplication in the following files: +Starting at line 104 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 114 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 96 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 111 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + + "con-conceptid$/attachments/filename.txt"))); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER, username = "test") + public void testDeleteSingleAttachment() throws Exception { + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); +===================================================================== +Found a 8 line (45 tokens) duplication in the following files: +Starting at line 136 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 147 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 147 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 172 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 138 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(0))); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER, username = "test") + public void testDeleteAllAttachments() throws Exception { + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); +===================================================================== +Found a 5 line (45 tokens) duplication in the following files: +Starting at line 104 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 72 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java + + mockMvc.perform(post(API_CONCEPT_URI).content(TestUtil.convertObjectToJsonBytes(concept)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); + + // read the concept under the new url + mockMvc.perform(get(API_CONCEPT_URI + "/" + concept.getId())).andExpect(status().isOk()); +===================================================================== +Found a 8 line (45 tokens) duplication in the following files: +Starting at line 337 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 261 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 276 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 338 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 336 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 310 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 485 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 359 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 316 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 398 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 890 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + .content(TestUtil.convertObjectToJsonBytes(metadata)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()).andExpect(jsonPath("$.errors[0].message", + containsString("global.error.shadow-save-not-allowed"))); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER) +===================================================================== +Found a 6 line (45 tokens) duplication in the following files: +Starting at line 149 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 180 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 206 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 202 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResourceTest.java +Starting at line 213 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResourceTest.java + + mockMvc.perform(put("/api/data-acquisition-projects" + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isNoContent()); + shadowCopyQueueItemService.executeShadowCopyActions(); + + UnitTestUserManagementUtils.logout(); +===================================================================== +Found a 6 line (45 tokens) duplication in the following files: +Starting at line 119 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 82 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java + + .perform(post(API_DATAPACKAGE_URI).content(TestUtil.convertObjectToJsonBytes(dataPackage)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); + + // read the dataPackage under the new url + mockMvc.perform(get(API_DATAPACKAGE_URI + "/" + dataPackage.getId())) +===================================================================== +Found a 6 line (45 tokens) duplication in the following files: +Starting at line 263 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 373 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java + + mockMvc.perform(delete(API_DATASETS_URI + "/" + dataSet.getId())) + .andExpect(status().is2xxSuccessful()); + + // check that the DataSet has been deleted + mockMvc.perform(get(API_DATASETS_URI + "/" + dataSet.getId())) + .andExpect(status().isNotFound()); +===================================================================== +Found a 8 line (45 tokens) duplication in the following files: +Starting at line 321 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 296 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 471 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 345 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 384 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 874 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + .content(TestUtil.convertObjectToJsonBytes(dataSet)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) + .andExpect(jsonPath("$.errors[0].message", containsString("global.error.shadow-create-not-allowed"))); + } + + @Test + @WithMockUser(authorities=AuthoritiesConstants.PUBLISHER) +===================================================================== +Found a 8 line (45 tokens) duplication in the following files: +Starting at line 120 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java +Starting at line 120 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java +Starting at line 121 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionImageShadowCopyServiceTest.java +Starting at line 117 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java + + DataSetAttachmentMetadata shadow = createShadow(master, "1.0.0"); + createTestFileForAttachment(shadow); + + shadowCopyService.createShadowCopies(dataAcquisitionProject.getId(), + dataAcquisitionProject.getRelease(), "1.0.0"); + + List files = new ArrayList<>(); + gridFsOperations.find(new Query()).forEach(files::add); +===================================================================== +Found a 4 line (45 tokens) duplication in the following files: +Starting at line 166 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetShadowCopyServiceTest.java +Starting at line 158 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentShadowCopyServiceTest.java +Starting at line 167 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionShadowCopyServiceTest.java +Starting at line 167 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyShadowCopyServiceTest.java + + DataSet shadow = new DataSet(master); + shadow.setId(master.getId() + "-" + version); + shadow.setDataPackageId(master.getDataPackageId() + "-" + version); + shadow.setDataAcquisitionProjectId(master.getDataAcquisitionProjectId() + "-" + version); +===================================================================== +Found a 10 line (45 tokens) duplication in the following files: +Starting at line 95 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 128 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 99 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 130 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java + + .content(TestUtil.convertObjectToJsonBytes(instrument)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); + + elasticsearchUpdateQueueService.processAllQueueItems(); + + // check that there is one instrument document + assertThat(elasticsearchAdminService.countAllDocuments(), equalTo(1L)); + + // check that auditing attributes have been set + mockMvc.perform(get(API_INSTRUMENTS_URI + "/" + instrument.getId())) +===================================================================== +Found a 4 line (45 tokens) duplication in the following files: +Starting at line 133 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 125 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java + + .andExpect(jsonPath("$[0].id", is(instrument.getId()))) + .andExpect(jsonPath("$[0].title.de", is("hurzDe3"))) + .andExpect(jsonPath("$[0].version", is(equalTo(2)))) + .andExpect(jsonPath("$[1].id", is(instrument.getId()))) +===================================================================== +Found a 4 line (45 tokens) duplication in the following files: +Starting at line 136 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 128 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java + + .andExpect(jsonPath("$[1].id", is(instrument.getId()))) + .andExpect(jsonPath("$[1].title.de", is("hurzDe2"))) + .andExpect(jsonPath("$[1].version", is(equalTo(1)))) + .andExpect(jsonPath("$[2].id", is(instrument.getId()))) +===================================================================== +Found a 10 line (45 tokens) duplication in the following files: +Starting at line 51 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/logmanagement/rest/LogsResourceTest.java +Starting at line 118 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/UserResourceTest.java + + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) + .andReturn(); + + String content = mvcResult.getResponse() + .getContentAsString(); + JSONArray jsonArray = new JSONArray(content); + + // Assert + assertThat(content, not(nullValue())); + assertThat(jsonArray.length(), greaterThan(0)); +===================================================================== +Found a 9 line (45 tokens) duplication in the following files: +Starting at line 209 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 271 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 388 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java + + DataSet dataSet = UnitTestCreateDomainObjectUtils.buildDataSet(project.getId(), survey.getId(), 1); + this.dataSetRepository.save(dataSet); + + //Instrument + Instrument instrument = UnitTestCreateDomainObjectUtils.buildInstrument(project.getId()); + this.instrumentRepository.save(instrument); + + //Question + Question question = UnitTestCreateDomainObjectUtils.buildQuestion(project.getId(), 123, "testProject-WrongQuestionname1" +===================================================================== +Found a 3 line (45 tokens) duplication in the following files: +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 140 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 157 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 176 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 204 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 191 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResourceTest.java +Starting at line 81 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 103 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 147 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + + mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isCreated()); +===================================================================== +Found a 5 line (45 tokens) duplication in the following files: +Starting at line 106 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 81 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + + mockMvc.perform(post(API_DATA_ACQUISITION_PROJECTS_URI).contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isCreated()); + + // read the project under the new url + mockMvc.perform(get(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId())) +===================================================================== +Found a 3 line (45 tokens) duplication in the following files: +Starting at line 202 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResourceTest.java +Starting at line 213 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResourceTest.java +Starting at line 110 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 117 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 159 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 169 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 180 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + + this.mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isNoContent()); +===================================================================== +Found a 6 line (45 tokens) duplication in the following files: +Starting at line 302 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 368 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + mockMvc.perform(delete(API_SURVEYS_URI + "/" + survey.getId())) + .andExpect(status().is2xxSuccessful()); + + // check that the survey is really deleted + mockMvc.perform(get(API_SURVEYS_URI + "/" + survey.getId())) + .andExpect(status().isNotFound()); +===================================================================== +Found a 11 line (45 tokens) duplication in the following files: +Starting at line 104 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyResponseRateImageShadowCopyServiceTest.java +Starting at line 132 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyResponseRateImageShadowCopyServiceTest.java + + createTestFileForSurveyRateImage(master); + SurveyResponseRateImageMetadata shadow = createShadow(master, "1.0.0"); + createTestFileForSurveyRateImage(shadow); + + DataAcquisitionProject dataAcquisitionProject = createDataAcquisitionProject(); + release.setVersion("1.0.1"); + + shadowCopyService.createShadowCopies(dataAcquisitionProject.getId(), + dataAcquisitionProject.getRelease(), "1.0.0"); + + Query predecessorQuery = new Query(GridFsCriteria.whereFilename().is(createFileName("1.0.0"))); +===================================================================== +Found a 8 line (45 tokens) duplication in the following files: +Starting at line 40 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/domain/QDaraUpdateQueueItem.java +Starting at line 44 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/domain/QElasticsearchUpdateQueueItem.java + + public final DateTimePath updateStartedAt = createDateTime("updateStartedAt", java.time.LocalDateTime.class); + + public final StringPath updateStartedBy = createString("updateStartedBy"); + + //inherited + public final NumberPath version = _super.version; + + public QDaraUpdateQueueItem(String variable) { +===================================================================== +Found a 5 line (45 tokens) duplication in the following files: +Starting at line 81 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 93 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java + + public final SetPath originalLanguages = _super.originalLanguages; + + public final ListPath questions = this.createList("questions", QuestionSubDocument.class, QQuestionSubDocument.class, PathInits.DIRECT2); + + public final StringPath release = createString("release"); +===================================================================== +Found a 6 line (45 tokens) duplication in the following files: +Starting at line 99 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 143 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 124 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 143 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 133 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java + + public final ListPath variables = this.createList("variables", VariableSubDocument.class, QVariableSubDocument.class, PathInits.DIRECT2); + + //inherited + public final NumberPath version = _super.version; + + public QConceptSearchDocument(String variable) { +===================================================================== +Found a 14 line (45 tokens) duplication in the following files: +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSubDocument.java +Starting at line 24 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationSubDocument.java + + public final ListPath authors = this.createList("authors", eu.dzhw.fdz.metadatamanagement.common.domain.Person.class, eu.dzhw.fdz.metadatamanagement.common.domain.QPerson.class, PathInits.DIRECT2); + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + public final StringPath doi = createString("doi"); + + public final StringPath id = createString("id"); + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; +===================================================================== +Found a 8 line (45 tokens) duplication in the following files: +Starting at line 49 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetNestedDocument.java +Starting at line 61 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSubDocument.java +Starting at line 49 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentNestedDocument.java +Starting at line 51 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableNestedDocument.java +Starting at line 57 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSubDocument.java + + public final BooleanPath shadow = createBoolean("shadow"); + + public final StringPath successorId = createString("successorId"); + + public final ListPath surveyIds = this.createList("surveyIds", String.class, StringPath.class, PathInits.DIRECT2); + + //inherited + public final NumberPath version; +===================================================================== +Found a 13 line (45 tokens) duplication in the following files: +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSubDocument.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSubDocument.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/QVariable.java + + public final ListPath conceptIds = this.createList("conceptIds", String.class, StringPath.class, PathInits.DIRECT2); + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + public final StringPath dataAcquisitionProjectId = createString("dataAcquisitionProjectId"); + + public final StringPath dataPackageId = createString("dataPackageId"); + + public final StringPath id = createString("id"); +===================================================================== +Found a 10 line (45 tokens) duplication in the following files: +Starting at line 46 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSubDocument.java +Starting at line 71 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/QVariable.java + + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + public final StringPath masterId = createString("masterId"); + + public final StringPath name = createString("name"); + + public final ListPath> relatedQuestions = this.>createList("relatedQuestions", eu.dzhw.fdz.metadatamanagement.variablemanagement.domain.projections.RelatedQuestionSubDocumentProjection.class, SimplePath.class, PathInits.DIRECT2); +===================================================================== +Found a 16 line (44 tokens) duplication in the following files: +Starting at line 97 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentService.java +Starting at line 169 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentService.java +Starting at line 162 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentService.java + + .read(DataPackageAttachmentMetadata.class, file.getMetadata()); + if (metadata.isShadow()) { + throw new ShadowCopyDeleteNotAllowedException(); + } + javers.commitShallowDelete(currentUser, metadata); + }); + this.operations.delete(query); + } + + /** + * Load all metadata objects from gridfs (ordered by indexInDataPackage). + * + * @param dataPackageId The id of the dataPackage. + * @return A list of metadata. + */ + public List findAllByDataPackage(String dataPackageId) { +===================================================================== +Found a 16 line (44 tokens) duplication in the following files: +Starting at line 158 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentService.java +Starting at line 100 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentService.java +Starting at line 93 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentService.java +Starting at line 80 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentService.java + + .read(DataPackageAttachmentMetadata.class, file.getMetadata()); + if (metadata.isShadow()) { + throw new ShadowCopyDeleteNotAllowedException(); + } + javers.commitShallowDelete(currentUser, metadata); + }); + this.operations.delete(query); + } + + /** + * Delete the attachment and its metadata from gridfs. + * + * @param dataPackageId The id of the dataPackage. + * @param filename The filename of the attachment. + */ + public void deleteByDataPackageIdAndFilename(String dataPackageId, String filename) { +===================================================================== +Found a 7 line (44 tokens) duplication in the following files: +Starting at line 47 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/DataSetSearchDocument.java +Starting at line 49 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/VariableSearchDocument.java + + private List nestedSurveys = new ArrayList<>(); + private List concepts = new ArrayList<>(); + private List nestedConcepts = new ArrayList<>(); + private Release release = null; + private Configuration configuration = null; + + private Integer maxNumberOfObservations; +===================================================================== +Found a 5 line (44 tokens) duplication in the following files: +Starting at line 76 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentService.java +Starting at line 144 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentService.java + + .regex("^" + Pattern.quote(SurveyAttachmentFilenameBuilder.buildFileNamePrefix(surveyId)))); + Iterable files = this.operations.find(query); + files.forEach(file -> { + SurveyAttachmentMetadata metadata = + mongoTemplate.getConverter().read(SurveyAttachmentMetadata.class, file.getMetadata()); +===================================================================== +Found a 7 line (44 tokens) duplication in the following files: +Starting at line 199 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 277 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java + + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isNoContent()); + + // read the updated attachment and check the version + mockMvc + .perform(get("/api/concepts/" + conceptAttachmentMetadata.getConceptId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.[0].version", is(1))) +===================================================================== +Found a 15 line (44 tokens) duplication in the following files: +Starting at line 61 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 46 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java +Starting at line 53 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAccessWaysResourceControllerTest.java +Starting at line 51 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 43 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/StudySeriesesResourceControllerTest.java +Starting at line 68 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 52 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java +Starting at line 50 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 51 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 38 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectLastReleaseResourceTest.java +Starting at line 38 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectReleasesResourceTest.java +Starting at line 65 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 44 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/rest/SearchResourceTest.java +Starting at line 62 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 51 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java + + @Autowired + private ElasticsearchAdminService elasticsearchAdminService; + + @Autowired + private JaversService javersService; + + private MockMvc mockMvc; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac).build(); + } + + @After + public void cleanUp() { +===================================================================== +Found a 5 line (44 tokens) duplication in the following files: +Starting at line 74 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java +Starting at line 108 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java + + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); + + // read the concept versions + mockMvc.perform(get(API_CONCEPT_URI + "/" + concept.getId() + "/versions")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(equalTo(1)))) +===================================================================== +Found a 3 line (44 tokens) duplication in the following files: +Starting at line 77 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java +Starting at line 87 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 92 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 86 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 87 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java + + mockMvc.perform(get(API_CONCEPT_URI + "/" + concept.getId() + "/versions")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(equalTo(1)))) + .andExpect(jsonPath("$[0].id", is(concept.getId()))) +===================================================================== +Found a 3 line (44 tokens) duplication in the following files: +Starting at line 111 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java +Starting at line 126 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 135 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java +Starting at line 130 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 122 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java + + mockMvc.perform(get(API_CONCEPT_URI + "/" + concept.getId() + "/versions")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(equalTo(3)))) + .andExpect(jsonPath("$[0].id", is(concept.getId()))) +===================================================================== +Found a 3 line (44 tokens) duplication in the following files: +Starting at line 133 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java +Starting at line 152 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java + + mockMvc.perform(get(API_CONCEPT_URI + "/" + concept.getId() + "/versions?skip=1")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(equalTo(2)))) + .andExpect(jsonPath("$[0].id", is(concept.getId()))) +===================================================================== +Found a 13 line (44 tokens) duplication in the following files: +Starting at line 56 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAccessWaysResourceControllerTest.java +Starting at line 54 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 46 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/StudySeriesesResourceControllerTest.java +Starting at line 55 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java +Starting at line 54 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 41 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectLastReleaseResourceTest.java +Starting at line 41 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectReleasesResourceTest.java +Starting at line 82 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + @Autowired + private JaversService javersService; + + private MockMvc mockMvc; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac).build(); + } + + @After + public void cleanUp() { + dataAcquisitionProjectRepository.deleteAll(); +===================================================================== +Found a 5 line (44 tokens) duplication in the following files: +Starting at line 110 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 221 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java + + .andExpect(jsonPath("$.[0].version", is(0))) + .andExpect(jsonPath("$.[0].createdBy", is("test"))) + .andExpect(jsonPath("$.[0].lastModifiedBy", is("test"))) + .andExpect(jsonPath("$.[0].masterId", + is("/public/files/data-packages/" + "stu-projectid$/attachments/filename.txt"))); +===================================================================== +Found a 12 line (44 tokens) duplication in the following files: +Starting at line 57 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 49 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/StudySeriesesResourceControllerTest.java +Starting at line 67 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DaraServiceTest.java + + private MockMvc mockMvc; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac) + .build(); + } + + @After + public void cleanUp() { + dataAcquisitionProjectRepository.deleteAll(); + dataPackageRepository.deleteAll(); +===================================================================== +Found a 6 line (44 tokens) duplication in the following files: +Starting at line 84 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 123 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java + + .andExpect(status().isCreated()); + + // read the dataPackage versions + mockMvc.perform(get(API_DATAPACKAGE_URI + "/" + dataPackage.getId() + "/versions")) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.length()", is(equalTo(1)))) +===================================================================== +Found a 7 line (44 tokens) duplication in the following files: +Starting at line 69 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/AvailableDataSetNumbersResourceControllerTest.java +Starting at line 63 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/AvailableInstrumentNumbersResourceControllerTest.java +Starting at line 63 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/AvailableSurveyNumbersResourceControllerTest.java + + mockMvc.perform(get("/api/data-acquisition-projects/test/available-data-set-numbers")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(1))) + .andExpect(jsonPath("$.[0]", is(1))); + } + + @Test + public void testAvailableNumbersIfThereIsOneDataSet() throws Exception { +===================================================================== +Found a 9 line (44 tokens) duplication in the following files: +Starting at line 211 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 292 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java + + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isNoContent()); + + // read the updated attachment and check the version + mockMvc + .perform(get( + "/api/data-sets/" + dataSetAttachmentMetadata.getDataSetId() + "/attachments")) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.[0].version", is(1))) +===================================================================== +Found a 6 line (44 tokens) duplication in the following files: +Starting at line 105 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 86 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java + + mockMvc.perform(put(API_DATASETS_URI + "/" + dataSet.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataSet)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); + + // check that auditing attributes have been set + mockMvc.perform(get(API_DATASETS_URI + "/" + dataSet.getId())) +===================================================================== +Found a 6 line (44 tokens) duplication in the following files: +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java +Starting at line 132 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java + + .andExpect(status().isCreated()); + + // read the data set versions + mockMvc.perform(get(API_DATASET_URI + "/" + dataSet.getId() + "/versions")) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.length()", is(equalTo(1)))) +===================================================================== +Found a 9 line (44 tokens) duplication in the following files: +Starting at line 159 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 270 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java + + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isNoContent()); + + // read the updated attachment and check the version + mockMvc + .perform(get( + "/api/instruments/" + instrumentAttachmentMetadata.getInstrumentId() + "/attachments")) + .andExpect(status().isOk()) + .andExpect( +===================================================================== +Found a 11 line (44 tokens) duplication in the following files: +Starting at line 217 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 240 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java + + public void testCreateWithWrongId() throws Exception { + // Arrange + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + this.dataAcquisitionProjectRepository.save(project); + + Instrument instrument = + UnitTestCreateDomainObjectUtils.buildInstrument(project.getId(), project.getId() + "-sy1"); + + // Act and Assert + // set inconsistent id + instrument.setId("hurz"); +===================================================================== +Found a 6 line (44 tokens) duplication in the following files: +Starting at line 271 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 83 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java + + mockMvc.perform(put(API_INSTRUMENTS_URI + "/" + instrument.getId()) + .content(TestUtil.convertObjectToJsonBytes(instrument)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); + + // check that the instrument has been created + mockMvc.perform(get(API_INSTRUMENTS_URI + "/" + instrument.getId())) +===================================================================== +Found a 6 line (44 tokens) duplication in the following files: +Starting at line 86 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 127 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java + + .andExpect(status().isCreated()); + + // read the instrument versions + mockMvc.perform(get(API_INSTRUMENT_URI + "/" + instrument.getId() + "/versions")) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.length()", is(equalTo(1)))) +===================================================================== +Found a 6 line (44 tokens) duplication in the following files: +Starting at line 68 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/ordermanagement/rest/OrderResourceTest.java +Starting at line 85 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/ordermanagement/rest/OrderResourceTest.java +Starting at line 117 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/ordermanagement/rest/OrderResourceTest.java + + order.getProducts().add(createProduct(order.getId())); + + mockMvc + .perform(put(UPDATE_ORDER_URL + order.getId()).contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(order))) + .andExpect(status().isOk()).andExpect(header().exists("Location")) +===================================================================== +Found a 7 line (44 tokens) duplication in the following files: +Starting at line 84 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DaraServiceTest.java +Starting at line 102 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DaraServiceTest.java + + public void testHealthCheck() throws Exception { + + //ASSERT + RestTemplate restTemplate = this.daraService.getRestTemplate(); + MockRestServiceServer mockServer = MockRestServiceServer.bindTo(restTemplate).build(); + mockServer + .expect(requestTo(this.daraService.getApiEndpoint() + DaraService.IS_ALiVE_ENDPOINT)) +===================================================================== +Found a 6 line (44 tokens) duplication in the following files: +Starting at line 161 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 279 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 338 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 396 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java + + Question question = UnitTestCreateDomainObjectUtils.buildQuestion(project.getId(), 1, instrument.getId() + ); + this.questionRepository.save(question); + QuestionImageMetadata questionImageMetadata = + UnitTestCreateDomainObjectUtils.buildQuestionImageMetadata(project.getId(), question.getId()); + UnitTestImageHelper.saveQuestionImage(this.questionImageService, questionImageMetadata); +===================================================================== +Found a 8 line (44 tokens) duplication in the following files: +Starting at line 187 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 246 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 308 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 359 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java + + this.dataPackageRepository.save(dataPackage); + + //Survey + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); + this.surveyRepository.save(survey); + List surveyNumbers = new ArrayList<>(); + surveyNumbers.add(1); + List listOfSurveyIds = new ArrayList<>(); +===================================================================== +Found a 6 line (44 tokens) duplication in the following files: +Starting at line 137 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 116 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isNotFound()); + + // create the project with the given id + mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isCreated()); +===================================================================== +Found a 5 line (44 tokens) duplication in the following files: +Starting at line 146 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 185 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java + + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().is2xxSuccessful()); + + // ensure it is really deleted + mockMvc.perform(get(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isNotFound()); +===================================================================== +Found a 5 line (44 tokens) duplication in the following files: +Starting at line 189 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResourceTest.java +Starting at line 201 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResourceTest.java +Starting at line 212 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResourceTest.java +Starting at line 145 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 158 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 168 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 179 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + + this.mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isCreated()); +===================================================================== +Found a 10 line (44 tokens) duplication in the following files: +Starting at line 227 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 251 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java + + .build()); + + // update the Question with the given id + mockMvc.perform(put(API_QUESTIONS_URI + "/" + question.getId()) + .content(TestUtil.convertObjectToJsonBytes(question))) + .andExpect(status().is4xxClientError()); + } + + @Test + public void testUpdateQuestionWithWrongNumber() throws Exception { +===================================================================== +Found a 6 line (44 tokens) duplication in the following files: +Starting at line 96 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 148 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 168 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 188 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 207 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 242 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 282 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java + + UnitTestCreateDomainObjectUtils.buildRelatedPublication(); + // ACT + // create the related publication with the given id + this.mockMvc.perform(put(API_RELATED_PUBLICATION_URI + "/" + relatedPublication.getId()) + .content(TestUtil.convertObjectToJsonBytes(relatedPublication)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); +===================================================================== +Found a 7 line (44 tokens) duplication in the following files: +Starting at line 193 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 271 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isNoContent()); + + // read the updated attachment and check the version + mockMvc + .perform(get("/api/surveys/" + surveyAttachmentMetadata.getSurveyId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.[0].version", is(1))) +===================================================================== +Found a 6 line (44 tokens) duplication in the following files: +Starting at line 90 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 136 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 191 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 294 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 320 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); + + // create the survey with the given id + mockMvc.perform(put(API_SURVEYS_URI + "/" + survey.getId()) + .content(TestUtil.convertObjectToJsonBytes(survey)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 6 line (44 tokens) duplication in the following files: +Starting at line 93 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 335 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 82 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java + + mockMvc.perform(put(API_SURVEYS_URI + "/" + survey.getId()) + .content(TestUtil.convertObjectToJsonBytes(survey)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); + + // read the survey under the new url + mockMvc.perform(get(API_SURVEYS_URI + "/" + survey.getId())) +===================================================================== +Found a 6 line (44 tokens) duplication in the following files: +Starting at line 84 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java +Starting at line 119 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java + + .andExpect(status().isCreated()); + + // read the dataPackage versions + mockMvc.perform(get(API_SURVEY_URI + "/" + survey.getId() + "/versions")) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.length()", is(equalTo(1)))) +===================================================================== +Found a 9 line (44 tokens) duplication in the following files: +Starting at line 103 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 135 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 163 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 180 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 198 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 216 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 234 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 260 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 288 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 318 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 346 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 368 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 397 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 429 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 451 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 469 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 486 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 504 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 543 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 562 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 581 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 639 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 676 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 696 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 716 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 736 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 756 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 776 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 797 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 823 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 842 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + public void testCreateVariable() throws Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + List surveyNumbers = new ArrayList<>(); + surveyNumbers.add(1); + + Variable variable = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "var1", 1, surveyNumbers); +===================================================================== +Found a 8 line (44 tokens) duplication in the following files: +Starting at line 334 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 553 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 619 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + variable.setLabel(new I18nString()); + + // create the variable with an empty label + mockMvc + .perform(put(API_VARIABLES_URI + "/" + variable.getId()) + .content(TestUtil.convertObjectToJsonBytes(variable)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()).andExpect(jsonPath("$.errors[0].message", +===================================================================== +Found a 8 line (44 tokens) duplication in the following files: +Starting at line 506 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 527 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + dataAcquisitionProjectRepository.save(project); + + List surveyNumbers = new ArrayList<>(); + surveyNumbers.add(1); + + Variable variable = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "var1", 1, surveyNumbers); + variable.setAccessWays(null); +===================================================================== +Found a 14 line (44 tokens) duplication in the following files: +Starting at line 28 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QDataSet.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java +Starting at line 31 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/domain/QQuestion.java +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSubDocument.java +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSubDocument.java +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSubDocument.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySubDocument.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSubDocument.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QSurvey.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/QVariable.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("annotations")); + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + public final StringPath dataAcquisitionProjectId = createString("dataAcquisitionProjectId"); + + public final StringPath dataPackageId = createString("dataPackageId"); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString description = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("description")); +===================================================================== +Found a 5 line (44 tokens) duplication in the following files: +Starting at line 68 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 83 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java + + public final ListPath nestedDataPackages = this.createList("nestedDataPackages", DataPackageNestedDocument.class, QDataPackageNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedDataSets = this.createList("nestedDataSets", DataSetNestedDocument.class, QDataSetNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedInstruments = this.createList("nestedInstruments", InstrumentNestedDocument.class, QInstrumentNestedDocument.class, PathInits.DIRECT2); +===================================================================== +Found a 12 line (44 tokens) duplication in the following files: +Starting at line 38 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageNestedDocument.java +Starting at line 40 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveyNestedDocument.java +Starting at line 44 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableNestedDocument.java + + public final StringPath lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate; + + public final StringPath masterId = createString("masterId"); + + public final BooleanPath shadow = createBoolean("shadow"); + + public final StringPath successorId = createString("successorId"); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString title; +===================================================================== +Found a 5 line (44 tokens) duplication in the following files: +Starting at line 89 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 81 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 89 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java + + public final ListPath nestedInstruments = this.createList("nestedInstruments", InstrumentNestedDocument.class, QInstrumentNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedQuestions = this.createList("nestedQuestions", QuestionNestedDocument.class, QQuestionNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedRelatedPublications = this.createList("nestedRelatedPublications", RelatedPublicationNestedDocument.class, QRelatedPublicationNestedDocument.class, PathInits.DIRECT2); +===================================================================== +Found a 5 line (44 tokens) duplication in the following files: +Starting at line 95 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 121 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + public final ListPath nestedSponsors = this.createList("nestedSponsors", eu.dzhw.fdz.metadatamanagement.common.domain.I18nString.class, eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString.class, PathInits.DIRECT2); + + public final ListPath nestedSurveys = this.createList("nestedSurveys", SurveyNestedDocument.class, QSurveyNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedVariables = this.createList("nestedVariables", VariableNestedDocument.class, QVariableNestedDocument.class, PathInits.DIRECT2); +===================================================================== +Found a 6 line (44 tokens) duplication in the following files: +Starting at line 51 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetNestedDocument.java +Starting at line 51 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentNestedDocument.java +Starting at line 57 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSubDocument.java +Starting at line 53 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableNestedDocument.java +Starting at line 59 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSubDocument.java + + public final StringPath successorId = createString("successorId"); + + public final ListPath surveyIds = this.createList("surveyIds", String.class, StringPath.class, PathInits.DIRECT2); + + //inherited + public final NumberPath version; +===================================================================== +Found a 5 line (43 tokens) duplication in the following files: +Starting at line 42 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/rest/I18nResourceController.java +Starting at line 26 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataFormatsResource.java +Starting at line 34 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveySampleTypeResource.java + + public ResponseEntity> getCountryCodes() { + return ResponseEntity.ok() + .cacheControl(CacheControl.maxAge(0, TimeUnit.DAYS).mustRevalidate().cachePublic()) + .eTag(ETAG.toString()) + .body(countryCodeProvider.getCountryCodes()); +===================================================================== +Found a 15 line (43 tokens) duplication in the following files: +Starting at line 99 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptAttachmentService.java +Starting at line 141 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentService.java +Starting at line 153 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentService.java +Starting at line 146 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentService.java +Starting at line 132 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentService.java + + result.add(mongoTemplate.getConverter().read(ConceptAttachmentMetadata.class, + gridfsFile.getMetadata())); + }); + return result; + } + + + + /** + * Delete all attachments of all {@link Concept}s. + */ + public void deleteAll() { + String currentUser = SecurityUtils.getCurrentUserLogin(); + Query query = new Query(GridFsCriteria.whereFilename() + .regex("^" + Pattern.quote("/concepts/") + ".*" + Pattern.quote("/attachments/"))); +===================================================================== +Found a 9 line (43 tokens) duplication in the following files: +Starting at line 52 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/DataSet.java +Starting at line 50 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/Instrument.java + + message = "data-set-management.error.data-set.unique-data-set-number-in-project") +@CompoundIndex(def = "{number: 1, dataAcquisitionProjectId: 1}", unique = true) +@EqualsAndHashCode(callSuper = false, of = "id") +@ToString(callSuper = true) +@NoArgsConstructor +@Data +@AllArgsConstructor +@Builder +@ValidShadowId(message = "data-set-management.error.data-set.id.pattern") +===================================================================== +Found a 9 line (43 tokens) duplication in the following files: +Starting at line 74 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 84 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 85 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 69 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 84 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + this.gridFsOperations.delete(new Query()); + } + + @Test + @WithMockUser(authorities=AuthoritiesConstants.PUBLISHER, username="test") + public void testUploadValidAttachment() throws Exception { + + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); +===================================================================== +Found a 7 line (43 tokens) duplication in the following files: +Starting at line 295 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 297 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 276 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + "/api/data-packages/" + dataPackageAttachmentMetadata.getDataPackageId() + "/attachments")) + .andExpect(status().isOk()).andExpect(content().json("[]")); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER) + public void testCreateShadowCopyInstrumentAttachment() throws Exception { +===================================================================== +Found a 8 line (43 tokens) duplication in the following files: +Starting at line 329 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 332 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 310 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + String filename = DataPackageAttachmentFilenameBuilder.buildFileName(metadata); + try (InputStream is = new ByteArrayInputStream("Test".getBytes(StandardCharsets.UTF_8))) { + gridFsMetadataUpdateService.store(is, filename, "text/plain", metadata); + } + + mockMvc + .perform( + put("/api/data-packages/" + dataPackageId + "/attachments/" + metadata.getFileName()) +===================================================================== +Found a 7 line (43 tokens) duplication in the following files: +Starting at line 373 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 374 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 352 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + String filename = DataPackageAttachmentFilenameBuilder.buildFileName(metadata); + try (InputStream is = new ByteArrayInputStream("Test".getBytes(StandardCharsets.UTF_8))) { + gridFsMetadataUpdateService.store(is, filename, "text/plain", metadata); + } + + mockMvc + .perform(delete( +===================================================================== +Found a 6 line (43 tokens) duplication in the following files: +Starting at line 118 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 140 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 170 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 196 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 93 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 190 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 221 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 79 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 113 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 120 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java + + DataPackage dataPackage = UnitTestCreateDomainObjectUtils.buildDataPackage(project.getId()); + + // create the dataPackage with the given id + mockMvc.perform(put(API_DATAPACKAGE_URI + "/" + dataPackage.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataPackage)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); +===================================================================== +Found a 3 line (43 tokens) duplication in the following files: +Starting at line 159 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 187 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java + + mockMvc.perform(get(API_DATAPACKAGE_URI)).andExpect(status().isOk()) + .andExpect(jsonPath("$.content.length()", is(1))) + .andExpect(jsonPath("$.content[0].masterId", is(dataPackage.getId()))); +===================================================================== +Found a 16 line (43 tokens) duplication in the following files: +Starting at line 42 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageShadowCopyServiceTest.java +Starting at line 42 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentShadowCopyServiceTest.java +Starting at line 47 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionShadowCopyServiceTest.java +Starting at line 42 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyShadowCopyServiceTest.java +Starting at line 43 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/VariableShadowCopyServiceTest.java + + private DataPackageShadowCopyService shadowCopyService; + + @Autowired + private ElasticsearchUpdateQueueItemRepository elasticsearchUpdateQueueItemRepository; + + @Autowired + private ElasticsearchAdminService elasticsearchAdminService; + + private DataAcquisitionProject project; + + private Release release; + + @Before + public void setUp() { + release = new Release("1.0.0", LocalDateTime.now(), null, false); + DataAcquisitionProject releasedProject = +===================================================================== +Found a 11 line (43 tokens) duplication in the following files: +Starting at line 56 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageShadowCopyServiceTest.java +Starting at line 60 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetShadowCopyServiceTest.java +Starting at line 56 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentShadowCopyServiceTest.java +Starting at line 61 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionShadowCopyServiceTest.java +Starting at line 59 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyShadowCopyServiceTest.java +Starting at line 57 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/VariableShadowCopyServiceTest.java + + release = new Release("1.0.0", LocalDateTime.now(), null, false); + DataAcquisitionProject releasedProject = + UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + releasedProject.setRelease(release); + project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + project.setRelease(release); + project.setId(PROJECT_ID); + } + + @After + public void tearDown() { +===================================================================== +Found a 7 line (43 tokens) duplication in the following files: +Starting at line 124 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageShadowCopyServiceTest.java +Starting at line 131 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetShadowCopyServiceTest.java +Starting at line 123 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentShadowCopyServiceTest.java +Starting at line 115 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/service/DataAcquisitionProjectShadowCopyServiceTest.java +Starting at line 131 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionShadowCopyServiceTest.java +Starting at line 124 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/VariableShadowCopyServiceTest.java + + dataPackageRepository.findAll().stream().filter(DataPackage::isShadow).collect(Collectors.toList()); + + assertThat(result.size(), equalTo(2)); + + String successorId = master.getId() + "-" + release.getVersion(); + + Optional successor = +===================================================================== +Found a 8 line (43 tokens) duplication in the following files: +Starting at line 82 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java +Starting at line 118 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java +Starting at line 127 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java + + survey.getNumber()); + + // create the data set with the given id + mockMvc + .perform(put(API_DATASET_URI + "/" + dataSet.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataSet)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 14 line (43 tokens) duplication in the following files: +Starting at line 36 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/filemanagement/rest/FileResourceTest.java +Starting at line 87 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java + + @Autowired + private JaversService javersService; + + private MockMvc mockMvc; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac) + .build(); + } + + @After + public void cleanUp() { + this.fileService.deleteTempFiles(); +===================================================================== +Found a 6 line (43 tokens) duplication in the following files: +Starting at line 164 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 250 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java + + instrument.setTitle(new I18nString("Hurz2", "Hurz2")); + + // update the instrument with the given id + mockMvc.perform(put(API_INSTRUMENTS_URI + "/" + instrument.getId()) + .content(TestUtil.convertObjectToJsonBytes(instrument)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().is2xxSuccessful()); +===================================================================== +Found a 8 line (43 tokens) duplication in the following files: +Starting at line 79 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 113 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 122 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java + + Instrument instrument = UnitTestCreateDomainObjectUtils.buildInstrument(project.getId()); + + // create the instrument with the given id + mockMvc + .perform(put(API_INSTRUMENT_URI + "/" + instrument.getId()) + .content(TestUtil.convertObjectToJsonBytes(instrument)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 8 line (43 tokens) duplication in the following files: +Starting at line 55 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailServiceTest.java +Starting at line 72 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailServiceTest.java + + Future futureVoid = this.mailService.sendActivationEmail(user); + futureVoid.get(); + Message[] messages = greenMail.getReceivedMessages(); + + // Arrange + assertThat(futureVoid.isDone(), is(true)); + assertThat(messages.length, is(1)); + } +===================================================================== +Found a 6 line (43 tokens) duplication in the following files: +Starting at line 137 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 347 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 116 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isNotFound()); + + // create the project with the given id + mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isCreated()); +===================================================================== +Found a 3 line (43 tokens) duplication in the following files: +Starting at line 247 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 264 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 281 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + mockMvc.perform(put(API_SURVEYS_URI + "/6").content(survey).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) + .andExpect(jsonPath("$.errors[0].invalidValue", is("2013-04-01d"))) +===================================================================== +Found a 6 line (43 tokens) duplication in the following files: +Starting at line 79 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java +Starting at line 109 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java +Starting at line 116 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java + + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); + + // create the dataPackage with the given id + mockMvc.perform(put(API_SURVEY_URI + "/" + survey.getId()) + .content(TestUtil.convertObjectToJsonBytes(survey)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 10 line (43 tokens) duplication in the following files: +Starting at line 82 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/repository/MongoDBTokenStoreTest.java +Starting at line 123 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/repository/MongoDBTokenStoreTest.java + + this.mongoDBTokenStore.readAuthentication(this.accessToken); + + // Assert + assertThat(auth2Authentication, not(nullValue())); + assertThat(auth2Authentication.getName(), is("principal")); + assertThat(auth2Authentication.getPrincipal(), is("principal")); + } + + @Test + public void testReadAccessToken() { +===================================================================== +Found a 10 line (43 tokens) duplication in the following files: +Starting at line 96 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/repository/MongoDBTokenStoreTest.java +Starting at line 148 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/repository/MongoDBTokenStoreTest.java + + this.mongoDBTokenStore.readAccessToken(this.accessToken.getValue()); + + // Assert + assertThat(accessToken, not(nullValue())); + assertThat(accessToken, is(this.accessToken)); + assertThat(accessToken.getRefreshToken(), is(this.refreshToken)); + } + + @Test + public void testReadRefreshToken() { +===================================================================== +Found a 11 line (43 tokens) duplication in the following files: +Starting at line 38 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/domain/QConcept.java +Starting at line 35 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSubDocument.java + + public final StringPath doi = createString("doi"); + + public final StringPath id = createString("id"); + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + public final StringPath license = createString("license"); +===================================================================== +Found a 9 line (43 tokens) duplication in the following files: +Starting at line 33 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 37 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationSearchDocument.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString completeTitle; + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + public final ListPath dataPackages = this.createList("dataPackages", DataPackageSubDocument.class, QDataPackageSubDocument.class, PathInits.DIRECT2); +===================================================================== +Found a 5 line (43 tokens) duplication in the following files: +Starting at line 89 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 133 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 118 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java +Starting at line 115 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 129 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java + + public final ListPath surveys = this.createList("surveys", SurveySubDocument.class, QSurveySubDocument.class, PathInits.DIRECT2); + + // custom + // inherited + public final eu.dzhw.fdz.metadatamanagement.conceptmanagement.domain.QTags tags = new eu.dzhw.fdz.metadatamanagement.conceptmanagement.domain.QTags(_super.tags); +===================================================================== +Found a 5 line (43 tokens) duplication in the following files: +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSubDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSubDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSubDocument.java + + public static final QDataSetSubDocument dataSetSubDocument = new QDataSetSubDocument("dataSetSubDocument"); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractRdcDomainObject _super = new eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractRdcDomainObject(this); + + public final ListPath accessWays = this.createList("accessWays", String.class, StringPath.class, PathInits.DIRECT2); +===================================================================== +Found a 5 line (42 tokens) duplication in the following files: +Starting at line 42 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/rest/I18nResourceController.java +Starting at line 56 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/rest/I18nResourceController.java +Starting at line 26 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataFormatsResource.java +Starting at line 34 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveySampleTypeResource.java + + public ResponseEntity> getCountryCodes() { + return ResponseEntity.ok() + .cacheControl(CacheControl.maxAge(0, TimeUnit.DAYS).mustRevalidate().cachePublic()) + .eTag(ETAG.toString()) + .body(countryCodeProvider.getCountryCodes()); +===================================================================== +Found a 20 line (42 tokens) duplication in the following files: +Starting at line 110 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageOverviewResource.java +Starting at line 107 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetReportResource.java + + dataPackageId, task, version); + return ResponseEntity.accepted().location(pollUri).body(task); + } else { + // Return bad request, if file is empty. + return ResponseEntity.badRequest().body(null); + } + } + + /** + * Upload the generated data package overview and attach it to the given {@link DataPackage}. + * + * @param overviewFile The pdf overview to attach to the given {@link DataPackage} + * @param language The language of the overview. Currently supports only 'de' or 'en'. + * @param dataPackageId The id of the {@link DataPackage} to which this file shall be attached. + * @param onBehalfOf Username of the MDM user who will receive an email, when the report has been + * successfully attached. + * @return 200 if attaching succeeded. + * @throws IOException Thrown if the multipart file cannot be read. + */ + @PostMapping(value = "/data-packages/{dataPackageId}/overview/{language}") +===================================================================== +Found a 10 line (42 tokens) duplication in the following files: +Starting at line 105 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java +Starting at line 121 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java + + String subject = messageSource.getMessage("email.activation.title", null, locale); + return sendEmail(null, new String[] {user.getEmail()}, null, null, subject, content, false, + true); + } + + /** + * Send password reset mail. + */ + @Async + public Future sendPasswordResetMail(User user) { +===================================================================== +Found a 12 line (42 tokens) duplication in the following files: +Starting at line 93 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/service/DaraUpdateQueueService.java +Starting at line 143 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java + + queueItemRepository.insert(new DaraUpdateQueueItem(projectId)); + } catch (DuplicateKeyException ex) { + log.debug("Ignoring attempt to enqueue a duplicate action."); + } + } + + /** + * Process the update queue every minute. + */ + @Scheduled(fixedRate = 1000 * 60, initialDelay = 1000 * 60) + public void processAllQueueItems() { + log.debug("Starting processing of DaraUpdateQueue..."); +===================================================================== +Found a 4 line (42 tokens) duplication in the following files: +Starting at line 45 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/DataSetSearchDocument.java +Starting at line 43 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/VariableSearchDocument.java + + private List nestedQuestions = new ArrayList<>(); + private List surveys = new ArrayList<>(); + private List nestedSurveys = new ArrayList<>(); + private List concepts = new ArrayList<>(); +===================================================================== +Found a 9 line (42 tokens) duplication in the following files: +Starting at line 346 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 433 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java + + projectRepository.findById(instrument.getDataAcquisitionProjectId()).orElse(null); + if (project == null) { + // project has been deleted, skip upsert + return false; + } + Release release = getRelease(project); + Configuration configuration = project.getConfiguration(); + DataPackageSubDocumentProjection dataPackage = + dataPackageRepository.findOneSubDocumentById(instrument.getDataPackageId()); +===================================================================== +Found a 3 line (42 tokens) duplication in the following files: +Starting at line 56 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/VariableChangesProvider.java +Starting at line 75 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/VariableChangesProvider.java + + if (oldDomainObjects.get(variableId) != null + && oldDomainObjects.get(variableId).getRelatedQuestions() != null) { + for (RelatedQuestion question : oldDomainObjects.get(variableId).getRelatedQuestions()) { +===================================================================== +Found a 6 line (42 tokens) duplication in the following files: +Starting at line 87 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 127 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 138 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 154 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 69 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java +Starting at line 98 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java +Starting at line 105 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java + + Concept concept = UnitTestCreateDomainObjectUtils.buildConcept(); + + // create the concept with the given id + mockMvc.perform(put(API_CONCEPT_URI + "/" + concept.getId()) + .content(TestUtil.convertObjectToJsonBytes(concept)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); +===================================================================== +Found a 8 line (42 tokens) duplication in the following files: +Starting at line 358 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 359 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 337 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + mockMvc.perform(delete("/api/data-packages/" + dataPackageId + "/attachments")) + .andExpect(status().isBadRequest()).andExpect(jsonPath("$.errors[0].message", + containsString("global.error.shadow-delete-not-allowed"))); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER) + public void testDeleteAttachmentOfShadowCopyDataPackage() throws Exception { +===================================================================== +Found a 8 line (42 tokens) duplication in the following files: +Starting at line 101 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 154 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java + + .andExpect(jsonPath("$.content.length()", is(0))); + + // get the empty list of pinned data packages + mockMvc.perform(get(API_DATAPACKAGE_URI + "?pinned=true")).andExpect(status().isOk()) + .andExpect(jsonPath("$.content.length()", is(0))); + + // get the empty list from the LEGACY URI + mockMvc.perform(get(API_LEGACY_URI)).andExpect(status().isOk()) +===================================================================== +Found a 6 line (42 tokens) duplication in the following files: +Starting at line 118 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 140 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 170 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 196 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 93 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 135 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 190 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 202 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 221 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 257 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 272 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 79 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 104 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 113 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 120 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java + + DataPackage dataPackage = UnitTestCreateDomainObjectUtils.buildDataPackage(project.getId()); + + // create the dataPackage with the given id + mockMvc.perform(put(API_DATAPACKAGE_URI + "/" + dataPackage.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataPackage)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); +===================================================================== +Found a 13 line (42 tokens) duplication in the following files: +Starting at line 75 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 61 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java + + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac).addFilter(legacyUrlsFilter).build(); + } + + @After + public void cleanUp() { + dataAcquisitionProjectRepository.deleteAll(); + dataPackageRepository.deleteAll(); + elasticsearchUpdateQueueItemRepository.deleteAll(); + elasticsearchAdminService.recreateAllIndices(); + javersService.deleteAll(); + } + + @Test +===================================================================== +Found a 7 line (42 tokens) duplication in the following files: +Starting at line 85 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java +Starting at line 157 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java + + dataAcquisitionProject.getRelease(), null); + + GridFSFile gridFsFile = gridFsOperations.findOne( + new Query(GridFsCriteria.whereMetaData("dataAcquisitionProjectId").is(PROJECT_ID + "-1.0.0") + .andOperator(GridFsCriteria.whereMetaData("shadow").is(true)))); + + DataPackageAttachmentMetadata metaData = +===================================================================== +Found a 8 line (42 tokens) duplication in the following files: +Starting at line 52 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageShadowCopyServiceTest.java +Starting at line 56 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetShadowCopyServiceTest.java +Starting at line 52 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentShadowCopyServiceTest.java +Starting at line 43 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/service/DataAcquisitionProjectShadowCopyServiceTest.java +Starting at line 57 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionShadowCopyServiceTest.java +Starting at line 53 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/VariableShadowCopyServiceTest.java + + private Release release; + + @Before + public void setUp() { + release = new Release("1.0.0", LocalDateTime.now(), null, false); + DataAcquisitionProject releasedProject = + UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + releasedProject.setRelease(release); +===================================================================== +Found a 5 line (42 tokens) duplication in the following files: +Starting at line 105 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageShadowCopyServiceTest.java +Starting at line 149 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageShadowCopyServiceTest.java + + assertThat(count, equalTo(2L)); + + Optional persistedShadow = dataPackageRepository.findById(shadow.getId()); + assertThat(persistedShadow.isPresent(), equalTo(true)); + assertThat(persistedShadow.get().getSuccessorId(), nullValue()); +===================================================================== +Found a 7 line (42 tokens) duplication in the following files: +Starting at line 101 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 165 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 184 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 200 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 215 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 239 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 255 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 284 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 294 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 333 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 365 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java + + DataSet dataSet = UnitTestCreateDomainObjectUtils.buildDataSet(project.getId(), survey.getId(), 1); + + // Act and Assert + // create the variable with the given id + mockMvc.perform(put(API_DATASETS_URI + "/" + dataSet.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataSet)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 6 line (42 tokens) duplication in the following files: +Starting at line 258 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 369 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 86 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java + + mockMvc.perform(put(API_DATASETS_URI + "/" + dataSet.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataSet)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); + + // delete the DataSet + mockMvc.perform(delete(API_DATASETS_URI + "/" + dataSet.getId())) +===================================================================== +Found a 8 line (42 tokens) duplication in the following files: +Starting at line 107 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java +Starting at line 118 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java +Starting at line 127 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java + + String firstDescription = dataSet.getDescription().getDe(); + + // create the data set with the given id + mockMvc + .perform(put(API_DATASET_URI + "/" + dataSet.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataSet)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 7 line (42 tokens) duplication in the following files: +Starting at line 85 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java +Starting at line 157 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java + + dataAcquisitionProject.getRelease(), null); + + GridFSFile gridFsFile = gridFsOperations.findOne( + new Query(GridFsCriteria.whereMetaData("dataAcquisitionProjectId").is(PROJECT_ID + "-1.0.0") + .andOperator(GridFsCriteria.whereMetaData("shadow").is(true)))); + + DataSetAttachmentMetadata metaData = mongoTemplate.getConverter() +===================================================================== +Found a 5 line (42 tokens) duplication in the following files: +Starting at line 111 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetShadowCopyServiceTest.java +Starting at line 157 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetShadowCopyServiceTest.java + + assertThat(count, equalTo(2L)); + + Optional persistedShadow = dataSetRepository.findById(shadow.getId()); + assertThat(persistedShadow.isPresent(), equalTo(true)); + assertThat(persistedShadow.get().getSuccessorId(), nullValue()); +===================================================================== +Found a 8 line (42 tokens) duplication in the following files: +Starting at line 83 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 117 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 146 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 186 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 217 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 240 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 262 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java + + public void testCreateInstrument() throws Exception { + + // Arrange + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + this.dataAcquisitionProjectRepository.save(project); + + Instrument instrument = + UnitTestCreateDomainObjectUtils.buildInstrument(project.getId(), project.getId() + "-sy1"); +===================================================================== +Found a 7 line (42 tokens) duplication in the following files: +Starting at line 90 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 152 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 164 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 192 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 205 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 228 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 250 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 268 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 307 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java + + UnitTestCreateDomainObjectUtils.buildInstrument(project.getId(), project.getId() + "-sy1"); + + // Act and Assert + // create the instrument with the given id + mockMvc.perform(put(API_INSTRUMENTS_URI + "/" + instrument.getId()) + .content(TestUtil.convertObjectToJsonBytes(instrument)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 6 line (42 tokens) duplication in the following files: +Starting at line 156 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 196 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 83 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java + + mockMvc.perform(put(API_INSTRUMENTS_URI + "/" + instrument.getId()) + .content(TestUtil.convertObjectToJsonBytes(instrument)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); + + // delete the survey + mockMvc.perform(delete(API_INSTRUMENTS_URI + "/" + instrument.getId())) +===================================================================== +Found a 8 line (42 tokens) duplication in the following files: +Starting at line 102 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 113 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 122 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java + + String firstTitle = instrument.getTitle().getDe(); + + // create the instrument with the given id + mockMvc + .perform(put(API_INSTRUMENT_URI + "/" + instrument.getId()) + .content(TestUtil.convertObjectToJsonBytes(instrument)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 7 line (42 tokens) duplication in the following files: +Starting at line 85 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java +Starting at line 160 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java + + dataAcquisitionProject.getRelease(), null); + + GridFSFile gridFsFile = gridFsOperations.findOne( + new Query(GridFsCriteria.whereMetaData("dataAcquisitionProjectId").is(PROJECT_ID + "-1.0.0") + .andOperator(GridFsCriteria.whereMetaData("shadow").is(true)))); + + InstrumentAttachmentMetadata metaData = mongoTemplate.getConverter() +===================================================================== +Found a 5 line (42 tokens) duplication in the following files: +Starting at line 105 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentShadowCopyServiceTest.java +Starting at line 149 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentShadowCopyServiceTest.java + + assertThat(count, equalTo(2L)); + + Optional persistedShadow = instrumentRepository.findById(shadow.getId()); + assertThat(persistedShadow.isPresent(), equalTo(true)); + assertThat(persistedShadow.get().getSuccessorId(), nullValue()); +===================================================================== +Found a 5 line (42 tokens) duplication in the following files: +Starting at line 87 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 121 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 137 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 155 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 173 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 179 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 201 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 209 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 335 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 347 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 358 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 366 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 79 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 101 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 109 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 116 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + // create the project with the given id + mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isCreated()); +===================================================================== +Found a 6 line (42 tokens) duplication in the following files: +Starting at line 386 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 407 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 422 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 439 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 456 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 482 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java + + rdcProjectRepository.save(project); + + mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .content(TestUtil.convertObjectToJsonBytes(project)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isNoContent()); +===================================================================== +Found a 5 line (42 tokens) duplication in the following files: +Starting at line 108 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResourceTest.java +Starting at line 162 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResourceTest.java + + .andExpect(status().isNotFound()); + + this.mockMvc + .perform(get(API_DATA_ACQUISITION_PROJECTS_URI + "/" + projectId + "/shadows/1.0.0/action")) + .andExpect(status().isOk()).andExpect(jsonPath("$.size()", is(0))); +===================================================================== +Found a 5 line (42 tokens) duplication in the following files: +Starting at line 96 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/service/DataAcquisitionProjectShadowCopyServiceTest.java +Starting at line 140 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/service/DataAcquisitionProjectShadowCopyServiceTest.java + + assertThat(count, equalTo(2L)); + + Optional persistedShadow = projectRepository.findById(shadow.getId()); + assertThat(persistedShadow.isPresent(), equalTo(true)); + assertThat(persistedShadow.get().getSuccessorId(), nullValue()); +===================================================================== +Found a 11 line (42 tokens) duplication in the following files: +Starting at line 88 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 120 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 147 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 171 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 210 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 236 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 312 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java + + public void testCreateQuestion() throws Exception { + + // Arrange + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + this.dataAcquisitionProjectRepository.save(project); + + Question question = UnitTestCreateDomainObjectUtils + .buildQuestion(project.getId(), 123, "instrument-Id"); + // Act and Assert + // create the Question with the given id + mockMvc.perform(put(API_QUESTIONS_URI + "/" + question.getId()) +===================================================================== +Found a 6 line (42 tokens) duplication in the following files: +Starting at line 95 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 177 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 188 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 216 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 242 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 267 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 284 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 301 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 318 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 356 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java + + .buildQuestion(project.getId(), 123, "instrument-Id"); + // Act and Assert + // create the Question with the given id + mockMvc.perform(put(API_QUESTIONS_URI + "/" + question.getId()) + .content(TestUtil.convertObjectToJsonBytes(question)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 7 line (42 tokens) duplication in the following files: +Starting at line 86 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionImageShadowCopyServiceTest.java +Starting at line 158 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionImageShadowCopyServiceTest.java + + dataAcquisitionProject.getRelease(), null); + + GridFSFile gridFsFile = gridFsOperations.findOne( + new Query(GridFsCriteria.whereMetaData("dataAcquisitionProjectId").is(PROJECT_ID + "-1.0.0") + .andOperator(GridFsCriteria.whereMetaData("shadow").is(true)))); + + QuestionImageMetadata metaData = +===================================================================== +Found a 5 line (42 tokens) duplication in the following files: +Starting at line 112 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionShadowCopyServiceTest.java +Starting at line 158 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionShadowCopyServiceTest.java + + assertThat(count, equalTo(2L)); + + Optional persistedShadow = questionRepository.findById(shadow.getId()); + assertThat(persistedShadow.isPresent(), equalTo(true)); + assertThat(persistedShadow.get().getSuccessorId(), nullValue()); +===================================================================== +Found a 6 line (42 tokens) duplication in the following files: +Starting at line 90 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 151 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 174 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 212 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 231 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 294 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 320 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 395 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); + + // create the survey with the given id + mockMvc.perform(put(API_SURVEYS_URI + "/" + survey.getId()) + .content(TestUtil.convertObjectToJsonBytes(survey)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 6 line (42 tokens) duplication in the following files: +Starting at line 136 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 191 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 333 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + survey.setDataType(I18nString.builder().de("Mixed Methods").en("Mixed Methods").build()); + + // create the survey with the given id but with wrong period + mockMvc.perform(put(API_SURVEYS_URI + "/" + survey.getId()) + .content(TestUtil.convertObjectToJsonBytes(survey)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) +===================================================================== +Found a 6 line (42 tokens) duplication in the following files: +Starting at line 297 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 323 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 82 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java + + mockMvc.perform(put(API_SURVEYS_URI + "/" + survey.getId()) + .content(TestUtil.convertObjectToJsonBytes(survey)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); + + // delete the survey + mockMvc.perform(delete(API_SURVEYS_URI + "/" + survey.getId())) +===================================================================== +Found a 9 line (42 tokens) duplication in the following files: +Starting at line 231 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResponseRateImageResourceTest.java +Starting at line 196 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyResponseRateImageShadowCopyServiceTest.java + + } + + private SurveyResponseRateImageMetadata createResponseRateImageMetadata() { + SurveyResponseRateImageMetadata master = new SurveyResponseRateImageMetadata(); + master.setSurveyId(SURVEY_ID); + master.setDataAcquisitionProjectId(PROJECT_ID); + master.setLanguage("en"); + master.setFileName(FILE_NAME); + master.setSurveyNumber(1); +===================================================================== +Found a 6 line (42 tokens) duplication in the following files: +Starting at line 100 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java +Starting at line 109 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java +Starting at line 116 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java + + String firstTitle = survey.getTitle().getDe(); + + // create the survey with the given id + mockMvc.perform(put(API_SURVEY_URI + "/" + survey.getId()) + .content(TestUtil.convertObjectToJsonBytes(survey)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 7 line (42 tokens) duplication in the following files: +Starting at line 81 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java +Starting at line 154 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java + + dataAcquisitionProject.getRelease(), null); + + GridFSFile gridFsFile = gridFsOperations.findOne( + new Query(GridFsCriteria.whereMetaData("dataAcquisitionProjectId").is(PROJECT_ID + "-1.0.0") + .andOperator(GridFsCriteria.whereMetaData("shadow").is(true)))); + + SurveyAttachmentMetadata metaData = +===================================================================== +Found a 5 line (42 tokens) duplication in the following files: +Starting at line 98 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java +Starting at line 165 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java + + equalTo("/surveys/sur-the-dataacquisition-project-id-sy1$-1.0.0/attachments/filename.txt")); + + List expectedFiles = new ArrayList<>(); + expectedFiles.add("/surveys/" + master.getSurveyId() + "/attachments/filename.txt"); + expectedFiles.add("/surveys/" + master.getSurveyId() + "-1.0.0/attachments/filename.txt"); +===================================================================== +Found a 7 line (42 tokens) duplication in the following files: +Starting at line 111 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java +Starting at line 142 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java + + public void createShadowCopyWithSameReleaseVersion() throws Exception { + SurveyAttachmentMetadata master = + UnitTestCreateDomainObjectUtils.buildSurveyAttachmentMetadata(PROJECT_ID, 1); + master.generateId(); + master.setMasterId(master.getId()); + createTestFileForAttachment(master); + SurveyAttachmentMetadata shadow = createShadow(master, release.getVersion()); +===================================================================== +Found a 5 line (42 tokens) duplication in the following files: +Starting at line 109 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyShadowCopyServiceTest.java +Starting at line 153 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyShadowCopyServiceTest.java + + assertThat(count, equalTo(2L)); + + Optional persistedShadow = surveyRepository.findById(shadow.getId()); + assertThat(persistedShadow.isPresent(), equalTo(true)); + assertThat(persistedShadow.get().getSuccessorId(), nullValue()); +===================================================================== +Found a 7 line (42 tokens) duplication in the following files: +Starting at line 162 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/repository/MongoDBTokenStoreTest.java +Starting at line 176 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/repository/MongoDBTokenStoreTest.java + + this.mongoDBTokenStore.findTokensByClientId("clientId"); + + // Assert + assertThat(accessTokens, not(nullValue())); + assertThat(accessTokens.size(), is(1)); + assertThat(accessTokens.contains(this.accessToken), is(true)); + } +===================================================================== +Found a 6 line (42 tokens) duplication in the following files: +Starting at line 111 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 189 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 207 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 225 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 305 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 327 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 334 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 355 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 384 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 416 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 460 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 477 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 495 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 513 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 534 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 553 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 571 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 589 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 646 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 658 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 686 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 706 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 746 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 766 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 805 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 886 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "var1", 1, surveyNumbers); + + // create the variable with the given id + mockMvc.perform(put(API_VARIABLES_URI + "/" + variable.getId()) + .content(TestUtil.convertObjectToJsonBytes(variable)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); +===================================================================== +Found a 6 line (42 tokens) duplication in the following files: +Starting at line 171 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 251 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 277 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 619 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 726 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 786 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + UnitTestCreateDomainObjectUtils.buildVariable(null, 1, "var1", 1, surveyNumbers); + + // create the variable with a survey but without a project + mockMvc.perform(put(API_VARIABLES_URI + "/" + variable.getId()) + .content(TestUtil.convertObjectToJsonBytes(variable)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isBadRequest()); +===================================================================== +Found a 8 line (42 tokens) duplication in the following files: +Starting at line 182 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 200 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 218 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 236 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 262 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 290 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 320 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 348 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 453 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 471 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 488 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 527 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 545 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 610 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 679 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 699 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 719 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 739 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 759 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 779 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 825 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 844 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + dataAcquisitionProjectRepository.save(project); + + List surveyNumbers = new ArrayList<>(); + surveyNumbers.add(1); + + Variable variable = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "var1", 1, surveyNumbers); + variable.setScaleLevel(null); +===================================================================== +Found a 10 line (42 tokens) duplication in the following files: +Starting at line 832 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 857 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + variable.setDataType(DataTypes.DATE); + + // create the variable with the given id + mockMvc + .perform(put(API_VARIABLES_URI + "/" + variable.getId()) + .content(TestUtil.convertObjectToJsonBytes(variable))) + .andExpect(status().is4xxClientError()); + } + + @Test +===================================================================== +Found a 5 line (42 tokens) duplication in the following files: +Starting at line 106 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/VariableShadowCopyServiceTest.java +Starting at line 150 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/VariableShadowCopyServiceTest.java + + assertThat(count, equalTo(2L)); + + Optional persistedShadow = variableRepository.findById(shadow.getId()); + assertThat(persistedShadow.isPresent(), equalTo(true)); + assertThat(persistedShadow.get().getSuccessorId(), nullValue()); +===================================================================== +Found a 3 line (42 tokens) duplication in the following files: +Starting at line 59 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 113 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java + + public final BooleanPath shadow = _super.shadow; + + public final ListPath sponsors = this.createList("sponsors", eu.dzhw.fdz.metadatamanagement.common.domain.I18nString.class, eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString.class, PathInits.DIRECT2); +===================================================================== +Found a 3 line (42 tokens) duplication in the following files: +Starting at line 66 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptNestedDocument.java +Starting at line 121 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 72 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageNestedDocument.java +Starting at line 165 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 76 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetNestedDocument.java +Starting at line 76 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentNestedDocument.java +Starting at line 146 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 78 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionNestedDocument.java +Starting at line 165 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 68 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationNestedDocument.java +Starting at line 110 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationSearchDocument.java +Starting at line 76 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveyNestedDocument.java +Starting at line 155 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java +Starting at line 78 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableNestedDocument.java +Starting at line 177 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + this._super = new QAbstractNestedSubDocument(type, metadata, inits); + this.completeTitle = inits.isInitialized("completeTitle") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("completeTitle")) : null; + this.createdBy = _super.createdBy; +===================================================================== +Found a 5 line (42 tokens) duplication in the following files: +Starting at line 72 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptNestedDocument.java +Starting at line 78 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageNestedDocument.java +Starting at line 83 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveyNestedDocument.java + + this.title = inits.isInitialized("title") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("title")) : null; + this.version = _super.version; + } + +} +===================================================================== +Found a 6 line (42 tokens) duplication in the following files: +Starting at line 76 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 104 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 91 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java + + public final ListPath nestedSurveys = this.createList("nestedSurveys", SurveyNestedDocument.class, QSurveyNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedVariables = this.createList("nestedVariables", VariableNestedDocument.class, QVariableNestedDocument.class, PathInits.DIRECT2); + + //inherited + public final SetPath originalLanguages = _super.originalLanguages; +===================================================================== +Found a 10 line (41 tokens) duplication in the following files: +Starting at line 116 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/websocket/domain/ActiveWebsocketSession.java +Starting at line 38 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/usermanagement/domain/Authority.java + + } + + @Override + public boolean equals(Object object) { + if (this == object) { + return true; + } + if (object == null || getClass() != object.getClass()) { + return false; + } +===================================================================== +Found a 5 line (41 tokens) duplication in the following files: +Starting at line 102 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageOverviewResource.java +Starting at line 99 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetReportResource.java + + Path zipTmpFilePath = Files.createTempFile(dataPackageId.replace("!", ""), ".zip"); + File zipTmpFile = zipTmpFilePath.toFile(); + templateZip.transferTo(zipTmpFile); + zipTmpFile.setWritable(true); + Task task = taskService.createTask(Task.TaskType.DATA_PACKAGE_OVERVIEW); +===================================================================== +Found a 7 line (41 tokens) duplication in the following files: +Starting at line 220 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentService.java +Starting at line 234 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentService.java + + .title("Datensatzreport:\n" + dataSet.getDescription().getDe()) + .description(new I18nString( + "Codebook/Variablenreport/Datensatzreport von \"" + dataSet.getDescription().getDe() + + "\"", + "Codebook/Variable Report/Dataset Report of \"" + dataSet.getDescription().getEn() + + "\"")) + .language("de").indexInDataSet(0).build(); +===================================================================== +Found a 5 line (41 tokens) duplication in the following files: +Starting at line 58 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/repository/DaraUpdateQueueItemRepositoryImpl.java +Starting at line 45 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/repository/ShadowCopyQueueRepositoryCustomImpl.java +Starting at line 46 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/repository/ElasticsearchUpdateQueueItemRepositoryImpl.java + + LocalDateTime updateStartedAt) { + Query query = new Query(new Criteria().andOperator(Criteria.where("updateStartedBy") + .is(updateStartedBy), + Criteria.where("updateStartedAt") + .is(updateStartedAt))).limit(BULK_SIZE) +===================================================================== +Found a 5 line (41 tokens) duplication in the following files: +Starting at line 47 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/DataSetSearchDocument.java +Starting at line 48 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/SurveySearchDocument.java +Starting at line 49 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/VariableSearchDocument.java + + private List nestedSurveys = new ArrayList<>(); + private List concepts = new ArrayList<>(); + private List nestedConcepts = new ArrayList<>(); + private Release release = null; + private Configuration configuration = null; +===================================================================== +Found a 10 line (41 tokens) duplication in the following files: +Starting at line 21 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/validation/ValidDataType.java +Starting at line 21 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/ValidDataType.java + +@Documented +@Constraint(validatedBy = {ValidDataTypeValidator.class}) +@Target({ElementType.FIELD}) +@Retention(RetentionPolicy.RUNTIME) +public @interface ValidDataType { + /** + * Defines the default error message. + */ + String message() default "{eu.dzhw.fdz.metadatamanagement.domain.validation." + + "validsurveydatatype.message}"; +===================================================================== +Found a 6 line (41 tokens) duplication in the following files: +Starting at line 135 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 167 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 146 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 179 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 146 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 179 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 203 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 137 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 164 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + .perform(get("/api/concepts/" + conceptAttachmentMetadata.getConceptId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(0))); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER, username = "test") +===================================================================== +Found a 9 line (41 tokens) duplication in the following files: +Starting at line 208 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 226 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 204 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java + + .andExpect(jsonPath("$.[0].language", is("en"))); + } + + @Test + @WithMockUser(authorities=AuthoritiesConstants.PUBLISHER) + public void testUploadAttachmentWithWrongType() throws Exception { + + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); +===================================================================== +Found a 9 line (41 tokens) duplication in the following files: +Starting at line 228 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 245 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 242 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 223 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 222 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + is("concept-management.error.concept-attachment-metadata.type.valid-type"))); + } + + @Test + @WithMockUser(authorities=AuthoritiesConstants.PUBLISHER) + public void testUploadAttachmentWithMissingDescription() throws Exception { + + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); +===================================================================== +Found a 4 line (41 tokens) duplication in the following files: +Starting at line 113 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java +Starting at line 129 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 133 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 125 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java + + .andExpect(jsonPath("$[0].id", is(concept.getId()))) + .andExpect(jsonPath("$[0].title.de", is("hurzDe3"))) + .andExpect(jsonPath("$[0].version", is(equalTo(2)))) + .andExpect(jsonPath("$[0].authors.length()", is(equalTo(concept.getAuthors().size())))) +===================================================================== +Found a 4 line (41 tokens) duplication in the following files: +Starting at line 119 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java +Starting at line 136 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 136 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 128 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java + + .andExpect(jsonPath("$[1].id", is(concept.getId()))) + .andExpect(jsonPath("$[1].title.de", is("hurzDe2"))) + .andExpect(jsonPath("$[1].version", is(equalTo(1)))) + .andExpect(jsonPath("$[1].authors.length()", is(equalTo(concept.getAuthors().size())))) +===================================================================== +Found a 4 line (41 tokens) duplication in the following files: +Starting at line 125 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java +Starting at line 143 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java + + .andExpect(jsonPath("$[2].id", is(concept.getId()))) + .andExpect(jsonPath("$[2].version", is(equalTo(0)))) + .andExpect(jsonPath("$[2].title.de", is(firstTitle))) + .andExpect(jsonPath("$[2].authors.length()", is(equalTo(concept.getAuthors().size())))) +===================================================================== +Found a 4 line (41 tokens) duplication in the following files: +Starting at line 135 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java +Starting at line 155 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java + + .andExpect(jsonPath("$[0].id", is(concept.getId()))) + .andExpect(jsonPath("$[0].title.de", is("hurzDe2"))) + .andExpect(jsonPath("$[0].version", is(equalTo(1)))) + .andExpect(jsonPath("$[0].authors.length()", is(equalTo(concept.getAuthors().size())))) +===================================================================== +Found a 4 line (41 tokens) duplication in the following files: +Starting at line 141 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java +Starting at line 162 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java + + .andExpect(jsonPath("$[1].id", is(concept.getId()))) + .andExpect(jsonPath("$[1].version", is(equalTo(0)))) + .andExpect(jsonPath("$[1].title.de", is(firstTitle))) + .andExpect(jsonPath("$[1].authors.length()", is(equalTo(concept.getAuthors().size())))) +===================================================================== +Found a 7 line (41 tokens) duplication in the following files: +Starting at line 329 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 374 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 352 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + String filename = DataPackageAttachmentFilenameBuilder.buildFileName(metadata); + try (InputStream is = new ByteArrayInputStream("Test".getBytes(StandardCharsets.UTF_8))) { + gridFsMetadataUpdateService.store(is, filename, "text/plain", metadata); + } + + mockMvc + .perform( +===================================================================== +Found a 7 line (41 tokens) duplication in the following files: +Starting at line 373 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 332 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 310 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + String filename = DataPackageAttachmentFilenameBuilder.buildFileName(metadata); + try (InputStream is = new ByteArrayInputStream("Test".getBytes(StandardCharsets.UTF_8))) { + gridFsMetadataUpdateService.store(is, filename, "text/plain", metadata); + } + + mockMvc + .perform(delete( +===================================================================== +Found a 4 line (41 tokens) duplication in the following files: +Starting at line 358 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 367 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java + + .andExpect(status().isOk()).andExpect(jsonPath("$.id", equalTo(dataPackage.getId()))) + .andExpect(jsonPath("$.masterId", equalTo(dataPackage.getMasterId()))) + .andExpect(jsonPath("$.completeTitle").exists()) + .andExpect(jsonPath("$.release.version", equalTo("2.0.0"))) +===================================================================== +Found a 10 line (41 tokens) duplication in the following files: +Starting at line 59 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 52 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DeleteAllDataPackagesResourceControllerTest.java +Starting at line 51 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/StudySeriesesResourceControllerTest.java +Starting at line 69 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DaraServiceTest.java + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac) + .build(); + } + + @After + public void cleanUp() { + dataAcquisitionProjectRepository.deleteAll(); + dataPackageRepository.deleteAll(); +===================================================================== +Found a 13 line (41 tokens) duplication in the following files: +Starting at line 46 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DeleteAllDataPackagesResourceControllerTest.java +Starting at line 46 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/AvailableDataSetNumbersResourceControllerTest.java +Starting at line 47 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DeleteAllDateSetsResourceControllerTest.java +Starting at line 41 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/AvailableInstrumentNumbersResourceControllerTest.java +Starting at line 50 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/DeleteAllInstrumentsResourceControllerTest.java +Starting at line 44 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/DeleteAllQuestionsResourceControllerTest.java +Starting at line 65 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 41 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/AvailableSurveyNumbersResourceControllerTest.java +Starting at line 48 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/DeleteAllSurveysResourceControllerTest.java +Starting at line 47 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/DeleteAllVariablesResourceControllerTest.java + + @Autowired + private ElasticsearchAdminService elasticsearchAdminService; + + @Autowired + private JaversService javersService; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac).build(); + } + + @After + public void cleanUp() { +===================================================================== +Found a 5 line (41 tokens) duplication in the following files: +Starting at line 85 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java +Starting at line 157 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java +Starting at line 160 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java +Starting at line 158 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionImageShadowCopyServiceTest.java +Starting at line 154 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java + + dataAcquisitionProject.getRelease(), null); + + GridFSFile gridFsFile = gridFsOperations.findOne( + new Query(GridFsCriteria.whereMetaData("dataAcquisitionProjectId").is(PROJECT_ID + "-1.0.0") + .andOperator(GridFsCriteria.whereMetaData("shadow").is(true)))); +===================================================================== +Found a 5 line (41 tokens) duplication in the following files: +Starting at line 157 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java +Starting at line 85 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java +Starting at line 85 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java +Starting at line 86 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionImageShadowCopyServiceTest.java +Starting at line 81 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java + + dataAcquisitionProject.getRelease(), "1.0.0"); + + GridFSFile gridFsFile = gridFsOperations.findOne( + new Query(GridFsCriteria.whereMetaData("dataAcquisitionProjectId").is(PROJECT_ID + "-1.0.0") + .andOperator(GridFsCriteria.whereMetaData("shadow").is(true)))); +===================================================================== +Found a 7 line (41 tokens) duplication in the following files: +Starting at line 151 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageShadowCopyServiceTest.java +Starting at line 159 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetShadowCopyServiceTest.java +Starting at line 151 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentShadowCopyServiceTest.java +Starting at line 142 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/service/DataAcquisitionProjectShadowCopyServiceTest.java +Starting at line 160 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionShadowCopyServiceTest.java +Starting at line 155 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyShadowCopyServiceTest.java +Starting at line 152 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/VariableShadowCopyServiceTest.java + + Optional persistedShadow = dataPackageRepository.findById(shadow.getId()); + + assertThat(persistedShadow.isPresent(), equalTo(true)); + assertThat(persistedShadow.get().getSuccessorId(), equalTo("DELETED")); + } + + private DataPackage createShadow(DataPackage master, String version) { +===================================================================== +Found a 9 line (41 tokens) duplication in the following files: +Starting at line 93 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 127 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 176 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 194 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 277 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java + + public void testCreateDataSet() throws Exception { + + // Arrange + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + this.dataAcquisitionProjectRepository.save(project); + + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); + + DataSet dataSet = UnitTestCreateDomainObjectUtils.buildDataSet(project.getId(), survey.getId(), 1); +===================================================================== +Found a 7 line (41 tokens) duplication in the following files: +Starting at line 139 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 131 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java + + .andExpect(jsonPath("$[2].id", is(instrument.getId()))) + .andExpect(jsonPath("$[2].version", is(equalTo(0)))) + .andExpect(jsonPath("$[2].title.de", is(firstTitle))); + } + + @Test + public void testInstrumentVersionsNotFound() throws IOException, Exception { +===================================================================== +Found a 9 line (41 tokens) duplication in the following files: +Starting at line 106 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java +Starting at line 140 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java + + assertExpectedFilesExistence(expectedFiles); + + GridFsResource shadowCopy = gridFsOperations + .getResource("/instruments/ins-" + PROJECT_ID + "-ins1$-1.0.0/attachments/filename.txt"); + assertThat(shadowCopy.getOptions().getMetadata().get("_contentType"), equalTo("text/plain")); + } + + @Test + public void createShadowCopyWithSameReleaseVersion() throws Exception { +===================================================================== +Found a 3 line (41 tokens) duplication in the following files: +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 140 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 157 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 176 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 204 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 202 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResourceTest.java +Starting at line 213 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResourceTest.java +Starting at line 81 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 103 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 159 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 169 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 180 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + + mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isCreated()); +===================================================================== +Found a 5 line (41 tokens) duplication in the following files: +Starting at line 123 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 182 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 210 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 336 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 348 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 360 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 368 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 191 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResourceTest.java +Starting at line 110 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 117 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 147 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + + mockMvc + .perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))) + .andExpect(status().is4xxClientError()).andExpect(jsonPath("$.errors[0].message", +===================================================================== +Found a 3 line (41 tokens) duplication in the following files: +Starting at line 99 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 151 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 171 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 191 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 211 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 218 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 246 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 286 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java + + this.mockMvc.perform(put(API_RELATED_PUBLICATION_URI + "/" + relatedPublication.getId()) + .content(TestUtil.convertObjectToJsonBytes(relatedPublication)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); +===================================================================== +Found a 4 line (41 tokens) duplication in the following files: +Starting at line 321 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java +Starting at line 382 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java +Starting at line 414 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java +Starting at line 441 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java + + new HashSet<>(Arrays.asList(AuthoritiesConstants.USER)), false); + + restMvc.perform(post("/api/register").contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(u))).andExpect(status().isCreated()); +===================================================================== +Found a 9 line (41 tokens) duplication in the following files: +Starting at line 163 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 608 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + public void testCreateVariableWithSurveyButWithoutProject() throws Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + List surveyNumbers = new ArrayList<>(); + surveyNumbers.add(1); + + Variable variable = + UnitTestCreateDomainObjectUtils.buildVariable(null, 1, "var1", 1, surveyNumbers); +===================================================================== +Found a 7 line (41 tokens) duplication in the following files: +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QDataSet.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/domain/QRelatedPublication.java +Starting at line 22 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QSurvey.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/QVariable.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractShadowableRdcDomainObject _super = new eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractShadowableRdcDomainObject(this); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("annotations")); + + //inherited + public final StringPath createdBy = _super.createdBy; +===================================================================== +Found a 11 line (41 tokens) duplication in the following files: +Starting at line 46 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 50 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QDataSet.java +Starting at line 39 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSubDocument.java +Starting at line 45 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSubDocument.java + + public final ListPath institutions = this.createList("institutions", eu.dzhw.fdz.metadatamanagement.common.domain.I18nString.class, eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString.class, PathInits.DIRECT2); + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + public final StringPath masterId = createString("masterId"); + + public final ListPath projectContributors = this.createList("projectContributors", eu.dzhw.fdz.metadatamanagement.common.domain.Person.class, eu.dzhw.fdz.metadatamanagement.common.domain.QPerson.class, PathInits.DIRECT2); +===================================================================== +Found a 6 line (41 tokens) duplication in the following files: +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QSubDataSet.java +Starting at line 20 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/QFilterDetails.java +Starting at line 20 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/QGenerationDetails.java + + public final SetPath> dataFormats = this.>createSet("dataFormats", DataFormat.class, EnumPath.class, PathInits.DIRECT2); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString description = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("description")); + + public final StringPath name = createString("name"); +===================================================================== +Found a 10 line (41 tokens) duplication in the following files: +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QAbstractNestedSubDocument.java +Starting at line 33 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 37 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationSearchDocument.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString completeTitle; + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + //inherited + public final StringPath id = _super.id; +===================================================================== +Found a 3 line (41 tokens) duplication in the following files: +Starting at line 87 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 95 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java + + public final ListPath nestedInstitutions = this.createList("nestedInstitutions", eu.dzhw.fdz.metadatamanagement.common.domain.I18nString.class, eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString.class, PathInits.DIRECT2); + + public final ListPath nestedInstruments = this.createList("nestedInstruments", InstrumentNestedDocument.class, QInstrumentNestedDocument.class, PathInits.DIRECT2); +===================================================================== +Found a 5 line (41 tokens) duplication in the following files: +Starting at line 84 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java +Starting at line 77 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 96 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 83 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java + + public final ListPath nestedConcepts = this.createList("nestedConcepts", ConceptNestedDocument.class, QConceptNestedDocument.class, PathInits.DIRECT2); + + public final QDataPackageNestedDocument nestedDataPackage; + + public final ListPath nestedInstruments = this.createList("nestedInstruments", InstrumentNestedDocument.class, QInstrumentNestedDocument.class, PathInits.DIRECT2); +===================================================================== +Found a 6 line (41 tokens) duplication in the following files: +Starting at line 122 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java +Starting at line 122 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString type; + + public final ListPath variables = this.createList("variables", VariableSubDocument.class, QVariableSubDocument.class, PathInits.DIRECT2); + + //inherited + public final NumberPath version; +===================================================================== +Found a 12 line (40 tokens) duplication in the following files: +Starting at line 148 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/service/AbstractAttachmentShadowCopyDataSource.java +Starting at line 79 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/service/helper/DataAcquisitionProjectShadowCopyDataSource.java + + } + + @Override + public void updateElasticsearch(String dataAcquisitionProjectId, String releaseVersion, + String previousVersion) { + // there is currently no elasticsearch index for attachments + } + + @Override + public void hideExistingShadowCopies(String projectId, String version) { + setHiddenState(projectId, version, true); + } +===================================================================== +Found a 8 line (40 tokens) duplication in the following files: +Starting at line 139 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/service/GenericDomainObjectCrudHelper.java +Starting at line 170 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/service/GenericDomainObjectCrudHelper.java + + T persisted = repository.save(domainObject); + if (elasticsearchType != null) { + elasticsearchUpdateQueueService.enqueue(persisted.getId(), this.elasticsearchType, + ElasticsearchUpdateQueueAction.UPSERT); + // flush the current changes + elasticsearchUpdateQueueService.processQueueItems(this.elasticsearchType); + } + applicationEventPublisher.publishEvent(new AfterCreateEvent(persisted)); +===================================================================== +Found a 6 line (40 tokens) duplication in the following files: +Starting at line 222 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/service/GenericDomainObjectCrudHelper.java +Starting at line 187 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/service/GenericShadowableDomainObjectCrudHelper.java + + SearchSourceBuilder builder = new SearchSourceBuilder(); + builder.fetchSource(null, + ExcludeFieldsHelper.getFieldsToExcludeOnDeserialization(searchDocumentClass)); + builder + .query(QueryBuilders + .constantScoreQuery(QueryBuilders.boolQuery().must(QueryBuilders.termQuery("id", id)))) +===================================================================== +Found a 4 line (40 tokens) duplication in the following files: +Starting at line 47 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResource.java +Starting at line 47 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResource.java +Starting at line 47 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResource.java +Starting at line 47 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResource.java +Starting at line 47 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResource.java + + @RequestMapping(path = "/concepts/attachments", method = RequestMethod.POST) + @Secured(value = {AuthoritiesConstants.PUBLISHER, AuthoritiesConstants.DATA_PROVIDER}) + public ResponseEntity uploadAttachment(@RequestPart("file") MultipartFile multiPartFile, + @RequestPart("conceptAttachmentMetadata") +===================================================================== +Found a 7 line (40 tokens) duplication in the following files: +Starting at line 49 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/helper/DataPackageAttachmentShadowCopyDataSource.java +Starting at line 48 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/helper/DataSetAttachmentShadowCopyDataSource.java +Starting at line 49 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/helper/InstrumentAttachmentShadowCopyDataSource.java +Starting at line 50 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/helper/QuestionImageShadowCopyDataSource.java +Starting at line 49 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/helper/SurveyAttachmentShadowCopyDataSource.java + + copy = converter.read(DataPackageAttachmentMetadata.class, gridFsFile.getMetadata()); + BeanUtils.copyProperties(source, copy, "version"); + } + + copy.setDataAcquisitionProjectId( + source.getDataAcquisitionProjectId() + "-" + release.getVersion()); + copy.setDataPackageId(source.getDataPackageId() + "-" + release.getVersion()); +===================================================================== +Found a 8 line (40 tokens) duplication in the following files: +Starting at line 80 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/helper/DataSetShadowCopyDataSource.java +Starting at line 82 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/helper/InstrumentShadowCopyDataSource.java +Starting at line 83 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/helper/QuestionShadowCopyDataSource.java +Starting at line 114 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/helper/VariableShadowCopyDataSource.java + + return surveyIds.stream().map(surveyId -> surveyId + "-" + version) + .collect(Collectors.toList()); + } + + @Override + public void deleteExistingShadowCopies(String projectId, String version) { + String oldProjectId = projectId + "-" + version; + try (Stream dataSets = dataSetRepository +===================================================================== +Found a 4 line (40 tokens) duplication in the following files: +Starting at line 69 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/repository/DaraUpdateQueueItemRepositoryImpl.java +Starting at line 78 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/repository/ElasticsearchUpdateQueueItemRepositoryImpl.java + + new Criteria().orOperator( + Criteria.where("updateStartedAt").lte(LocalDateTime.now() + .minusMinutes(UPDATE_LOCK_EXPIRED)), + Criteria.where("updateStartedAt").exists(false)), +===================================================================== +Found a 4 line (40 tokens) duplication in the following files: +Starting at line 27 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/service/DataAcquisitionProjectChangesProvider.java +Starting at line 39 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/service/DataAcquisitionProjectChangesProvider.java + + public List getAddedPublisherUserNamesList(String projectId) { + List oldPublishers = getPublishers(oldDomainObjects.get(projectId)); + List newPublishers = getPublishers(newDomainObjects.get(projectId)); + return ListUtils.diff(newPublishers, oldPublishers); +===================================================================== +Found a 4 line (40 tokens) duplication in the following files: +Starting at line 51 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/service/DataAcquisitionProjectChangesProvider.java +Starting at line 63 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/service/DataAcquisitionProjectChangesProvider.java + + public List getAddedDataProviderUserNamesList(String projectId) { + List oldDataProviders = getDataProviders(oldDomainObjects.get(projectId)); + List newDataProviders = getDataProviders(newDomainObjects.get(projectId)); + return ListUtils.diff(newDataProviders, oldDataProviders); +===================================================================== +Found a 4 line (40 tokens) duplication in the following files: +Starting at line 47 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionImageResource.java +Starting at line 46 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResponseRateImageResource.java + + @RequestMapping(path = "/questions/images", method = RequestMethod.POST) + @Secured(value = {AuthoritiesConstants.PUBLISHER, AuthoritiesConstants.DATA_PROVIDER}) + public ResponseEntity uploadImage(@RequestParam("image") MultipartFile multiPartFile, + @RequestPart("questionImageMetadata") @Valid QuestionImageMetadata questionImageMetadata) +===================================================================== +Found a 4 line (40 tokens) duplication in the following files: +Starting at line 315 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/unittesthelper/util/UnitTestCreateDomainObjectUtils.java +Starting at line 412 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/unittesthelper/util/UnitTestCreateDomainObjectUtils.java + + .title(I18nString.builder().de("Instrument.de").en("Instrument.en").build()) + .subtitle(I18nString.builder().de("Instrument Untertitel de") + .en("Instrument Subtitle en").build()) + .description(I18nString.builder().de("Instrument.de").en("Instrument.en").build()) +===================================================================== +Found a 5 line (40 tokens) duplication in the following files: +Starting at line 177 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 190 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java + + mockMvc.perform(put("/api/questions/" + question.getId()) + .content(TestUtil.convertObjectToJsonBytes(question)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().is2xxSuccessful()); + + mockMvc.perform(delete(API_CONCEPT_URI + "/" + conceptInQuestion.getId())) +===================================================================== +Found a 5 line (40 tokens) duplication in the following files: +Starting at line 195 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 250 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java + + instrument.setConceptIds(Collections.singletonList(conceptInInstrument.getId())); + + mockMvc.perform(put("/api/instruments/" + instrument.getId()) + .content(TestUtil.convertObjectToJsonBytes(instrument)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().is2xxSuccessful()); +===================================================================== +Found a 5 line (40 tokens) duplication in the following files: +Starting at line 197 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 167 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java + + mockMvc.perform(put("/api/instruments/" + instrument.getId()) + .content(TestUtil.convertObjectToJsonBytes(instrument)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().is2xxSuccessful()); + + mockMvc.perform(delete(API_CONCEPT_URI + "/" + conceptInInstrument.getId())) +===================================================================== +Found a 6 line (40 tokens) duplication in the following files: +Starting at line 79 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAccessWaysResourceControllerTest.java +Starting at line 67 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/StudySeriesesResourceControllerTest.java +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 115 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 141 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 161 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 180 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 200 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 235 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 264 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java + + public void testGetAccessWaysOfDataPackage() throws IOException, Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + DataPackage dataPackage = UnitTestCreateDomainObjectUtils.buildDataPackage(project.getId()); + dataPackageRepository.save(dataPackage); +===================================================================== +Found a 8 line (40 tokens) duplication in the following files: +Starting at line 314 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 317 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 322 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 296 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 110 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionImageResourceTest.java +Starting at line 345 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 295 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 385 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 198 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResponseRateImageResourceTest.java +Starting at line 875 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + .file(metadata)) + .andExpect(status().isBadRequest()).andExpect(jsonPath("$.errors[0].message", + containsString("global.error.shadow-create-not-allowed"))); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER) + public void testUpdateAttachmentOfShadowCopyDataPackage() throws Exception { +===================================================================== +Found a 8 line (40 tokens) duplication in the following files: +Starting at line 358 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 77 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DeleteAllDataPackagesResourceControllerTest.java +Starting at line 359 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 350 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 337 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 213 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResponseRateImageResourceTest.java + + mockMvc.perform(delete("/api/data-packages/" + dataPackageId + "/attachments")) + .andExpect(status().isBadRequest()).andExpect(jsonPath("$.errors[0].message", + containsString("global.error.shadow-delete-not-allowed"))); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER) + public void testDeleteAttachmentOfShadowCopyDataPackage() throws Exception { +===================================================================== +Found a 7 line (40 tokens) duplication in the following files: +Starting at line 313 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 348 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java + + dataPackage.setId(dataPackage.getId() + "-1.0.0"); + dataPackage.setDataAcquisitionProjectId(project.getId()); + dataPackage.setVersion(null); + dataPackage = dataPackageRepository.save(dataPackage); + + elasticsearchAdminService.recreateAllIndices(); + assertThat(elasticsearchAdminService.countAllDocuments(), equalTo(2L)); +===================================================================== +Found a 5 line (40 tokens) duplication in the following files: +Starting at line 97 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java +Starting at line 97 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java +Starting at line 97 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java +Starting at line 98 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionImageShadowCopyServiceTest.java + + equalTo("/public/files/data-packages/stu-" + PROJECT_ID + "$-1.0.0/attachments/filename.txt")); + assertThat(metaData.getDataAcquisitionProjectId(), equalTo(PROJECT_ID + "-1.0.0")); + assertThat(metaData.isShadow(), equalTo(true)); + assertThat(gridFsFile.getFilename(), + equalTo("/data-packages/stu-" + PROJECT_ID + "$-1.0.0/attachments/filename.txt")); +===================================================================== +Found a 10 line (40 tokens) duplication in the following files: +Starting at line 76 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 66 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 71 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac) + .build(); + } + + @After + public void cleanUp() { + this.dataAcquisitionProjectRepository.deleteAll(); + this.surveyRepository.deleteAll(); +===================================================================== +Found a 5 line (40 tokens) duplication in the following files: +Starting at line 97 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 131 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 251 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 280 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 41 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/CopyPropertiesTest.java + + this.dataAcquisitionProjectRepository.save(project); + + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); + + DataSet dataSet = UnitTestCreateDomainObjectUtils.buildDataSet(project.getId(), survey.getId(), 1); +===================================================================== +Found a 11 line (40 tokens) duplication in the following files: +Starting at line 267 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 306 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + mockMvc.perform(get(API_DATASETS_URI + "/" + dataSet.getId())) + .andExpect(status().isNotFound()); + + elasticsearchUpdateQueueService.processAllQueueItems(); + + // check that there are no more data set documents + assertThat(elasticsearchAdminService.countAllDocuments(), equalTo(0L)); + } + + @Test + public void testUpdateDataSet() throws Exception { +===================================================================== +Found a 5 line (40 tokens) duplication in the following files: +Starting at line 288 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 111 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java + + mockMvc.perform(put(API_DATASETS_URI + "/" + dataSet.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataSet)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); + + dataSet.getDescription() +===================================================================== +Found a 4 line (40 tokens) duplication in the following files: +Starting at line 93 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 169 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java + + .andExpect(jsonPath("$.[0].version", is(0))) + .andExpect(jsonPath("$.[0].createdBy", is("test"))) + .andExpect(jsonPath("$.[0].lastModifiedBy", is("test"))) + .andExpect(jsonPath("$.[0].type.en", is(InstrumentAttachmentTypes.QUESTION_FLOW.getEn()))); +===================================================================== +Found a 7 line (40 tokens) duplication in the following files: +Starting at line 110 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 122 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 142 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 186 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 198 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java + + .file(attachment).file(metadata)).andExpect(status().isCreated()); + + // ensure the uploaded file exists + mockMvc + .perform(get( + "/api/instruments/" + instrumentAttachmentMetadata.getInstrumentId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(1))); +===================================================================== +Found a 7 line (40 tokens) duplication in the following files: +Starting at line 203 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 94 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + + "/api/instruments/" + instrumentAttachmentMetadata.getInstrumentId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(0))); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER) + public void testUploadAttachmentWithWrongType() throws Exception { +===================================================================== +Found a 6 line (40 tokens) duplication in the following files: +Starting at line 85 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/ordermanagement/rest/OrderResourceTest.java +Starting at line 117 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/ordermanagement/rest/OrderResourceTest.java +Starting at line 128 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/ordermanagement/rest/OrderResourceTest.java + + order.setClient(OrderClient.DLP); + + mockMvc + .perform(put(UPDATE_ORDER_URL + order.getId()).contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(order))) + .andExpect(status().isOk()).andExpect(header().exists("Location")) +===================================================================== +Found a 5 line (40 tokens) duplication in the following files: +Starting at line 62 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectLastReleaseResourceTest.java +Starting at line 76 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectLastReleaseResourceTest.java +Starting at line 62 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectReleasesResourceTest.java + + project = dataAcquisitionProjectRepository.save(project); + + // assert that there are no releases yet + mockMvc.perform(get(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId() + "/releases")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(0))); +===================================================================== +Found a 8 line (40 tokens) duplication in the following files: +Starting at line 260 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 277 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 294 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java + + public void testCreateQuestionWithoutType() throws Exception { + // Arrange + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + this.dataAcquisitionProjectRepository.save(project); + + Question question = UnitTestCreateDomainObjectUtils + .buildQuestion(project.getId(), 123, "instrument-Id"); + question.setType(null); +===================================================================== +Found a 7 line (40 tokens) duplication in the following files: +Starting at line 352 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 366 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java + + public void testUpdateShadowCopyQuestion() throws Exception { + Question question = UnitTestCreateDomainObjectUtils + .buildQuestion("issue1991", 123, "instrument-Id"); + question.setId(question.getId() + "-1.0.0"); + questionRepository.save(question); + + mockMvc.perform(put(API_QUESTIONS_URI + "/" + question.getId()) +===================================================================== +Found a 5 line (40 tokens) duplication in the following files: +Starting at line 125 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 134 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 152 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 161 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 179 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + .file(metadata)).andExpect(status().isCreated()); + + // ensure that there is one attachment + mockMvc.perform(get("/api/surveys/" + surveyAttachmentMetadata.getSurveyId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(1)));; +===================================================================== +Found a 7 line (40 tokens) duplication in the following files: +Starting at line 105 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 137 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 371 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 401 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 433 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 527 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 799 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + dataAcquisitionProjectRepository.save(project); + + List surveyNumbers = new ArrayList<>(); + surveyNumbers.add(1); + + Variable variable = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "var1", 1, surveyNumbers); +===================================================================== +Found a 3 line (40 tokens) duplication in the following files: +Starting at line 36 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/domain/QConcept.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QSubDataSet.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/QFilterDetails.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/QGenerationDetails.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString description = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("description")); + + public final StringPath doi = createString("doi"); +===================================================================== +Found a 7 line (40 tokens) duplication in the following files: +Starting at line 53 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/domain/QConcept.java +Starting at line 73 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 71 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java +Starting at line 79 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QSurvey.java + + public final QTags tags = new QTags(forProperty("tags")); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString title = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("title")); + + //inherited + public final NumberPath version = _super.version; +===================================================================== +Found a 7 line (40 tokens) duplication in the following files: +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QDataSet.java +Starting at line 26 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/domain/QQuestion.java +Starting at line 22 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QSurvey.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractShadowableRdcDomainObject _super = new eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractShadowableRdcDomainObject(this); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("annotations")); + + //inherited + public final StringPath createdBy = _super.createdBy; +===================================================================== +Found a 7 line (40 tokens) duplication in the following files: +Starting at line 36 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 38 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QDataSet.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QSubDataSet.java +Starting at line 38 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java +Starting at line 21 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QPopulation.java +Starting at line 20 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/QFilterDetails.java +Starting at line 20 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/QGenerationDetails.java + + public final ListPath dataCurators = this.createList("dataCurators", eu.dzhw.fdz.metadatamanagement.common.domain.Person.class, eu.dzhw.fdz.metadatamanagement.common.domain.QPerson.class, PathInits.DIRECT2); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString description = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("description")); + + //inherited + public final BooleanPath hidden = _super.hidden; +===================================================================== +Found a 4 line (40 tokens) duplication in the following files: +Starting at line 46 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 39 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSubDocument.java +Starting at line 69 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationSearchDocument.java + + public final ListPath institutions = this.createList("institutions", eu.dzhw.fdz.metadatamanagement.common.domain.I18nString.class, eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString.class, PathInits.DIRECT2); + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; +===================================================================== +Found a 6 line (40 tokens) duplication in the following files: +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/domain/QRelatedPublication.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/QVariable.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractShadowableRdcDomainObject _super = new eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractShadowableRdcDomainObject(this); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("annotations")); + + public final ListPath conceptIds = this.createList("conceptIds", String.class, StringPath.class, PathInits.DIRECT2); +===================================================================== +Found a 4 line (40 tokens) duplication in the following files: +Starting at line 61 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java +Starting at line 100 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java + + public final BooleanPath shadow = _super.shadow; + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString subtitle = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("subtitle")); +===================================================================== +Found a 2 line (40 tokens) duplication in the following files: +Starting at line 64 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QAbstractNestedSubDocument.java +Starting at line 66 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptNestedDocument.java +Starting at line 72 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageNestedDocument.java +Starting at line 76 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetNestedDocument.java +Starting at line 76 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentNestedDocument.java +Starting at line 78 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionNestedDocument.java +Starting at line 68 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationNestedDocument.java +Starting at line 76 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveyNestedDocument.java +Starting at line 78 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableNestedDocument.java + + super(type, metadata, inits); + this.completeTitle = inits.isInitialized("completeTitle") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("completeTitle")) : null; +===================================================================== +Found a 4 line (40 tokens) duplication in the following files: +Starting at line 99 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 143 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 124 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java +Starting at line 143 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 133 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java + + public final ListPath variables = this.createList("variables", VariableSubDocument.class, QVariableSubDocument.class, PathInits.DIRECT2); + + //inherited + public final NumberPath version = _super.version; +===================================================================== +Found a 7 line (40 tokens) duplication in the following files: +Starting at line 35 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QSurvey.java +Starting at line 42 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/QVariable.java + + public final StringPath dataPackageId = createString("dataPackageId"); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString dataType = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("dataType")); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QPeriod fieldPeriod = new eu.dzhw.fdz.metadatamanagement.common.domain.QPeriod(forProperty("fieldPeriod")); +===================================================================== +Found a 17 line (39 tokens) duplication in the following files: +Starting at line 25 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/domain/validation/I18nStringEntireNotEmptyValidator.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/domain/validation/I18nStringNotEmptyValidator.java + + public void initialize(I18nStringEntireNotEmpty constraintAnnotation) {} + + /* + * (non-Javadoc) + * @see javax.validation.ConstraintValidator#isValid(java.lang.Object, + * javax.validation.ConstraintValidatorContext) + */ + @Override + public boolean isValid(I18nString value, ConstraintValidatorContext context) { + + //Empty check + if (value == null) { + return false; + } + + //Check De /En Empty String + return !Strings.isNullOrEmpty(value.getDe()) && !Strings.isNullOrEmpty(value.getEn()); +===================================================================== +Found a 13 line (39 tokens) duplication in the following files: +Starting at line 142 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/DataSetAttachmentMetadata.java +Starting at line 148 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/InstrumentAttachmentMetadata.java +Starting at line 141 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/SurveyAttachmentMetadata.java + + this.setId("/public/files/data-sets/" + dataSetId + "/attachments/" + fileName); + } + + @Override + protected void setMasterIdInternal(String masterId) { + this.masterId = masterId; + } + + @Override + protected void setIdInternal(String id) { + this.id = id; + } +} +===================================================================== +Found a 14 line (39 tokens) duplication in the following files: +Starting at line 309 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java +Starting at line 388 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java + + new Object[] {dataSetId, language}, locale); + sendEmail(sender, new String[] {user.getEmail()}, null, null, subject, content, false, true); + } + + /** + * Send the error during dataset report generation to the user who started the task and to all + * admins. + * + * @param onBehalfUser The user who has started the report generation. + * @param admins A list of admins. + * @param sender The sender of the email. + */ + @Async + public void sendDataSetReportErrorMail(User onBehalfUser, List admins, +===================================================================== +Found a 6 line (39 tokens) duplication in the following files: +Starting at line 35 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/DataSetSearchDocument.java +Starting at line 36 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/SurveySearchDocument.java + + static final String[] FIELDS_TO_EXCLUDE_ON_DESERIALIZATION = new String[] {"nested*", + "variables", "questions", "configuration", "guiLabels", "*Publications", "concepts"}; + + private DataPackageSubDocument dataPackage = null; + private DataPackageNestedDocument nestedDataPackage = null; + private List variables = new ArrayList<>(); +===================================================================== +Found a 6 line (39 tokens) duplication in the following files: +Starting at line 29 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/config/locale/AngularCookieLocaleResolverTest.java +Starting at line 44 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/config/locale/AngularCookieLocaleResolverTest.java + + public void testResolveLocale() { + // Arrange + AngularCookieLocaleResolver resolver = new AngularCookieLocaleResolver(); + HttpServletRequest servlet = Mockito.mock(HttpServletRequest.class); + when(servlet.getAttribute(CookieLocaleResolver.LOCALE_REQUEST_ATTRIBUTE_NAME)) + .thenReturn(Locale.GERMAN); +===================================================================== +Found a 9 line (39 tokens) duplication in the following files: +Starting at line 29 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/domain/util/PatternsTest.java +Starting at line 57 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/domain/util/PatternsTest.java + + boolean validGermanUmlaut = Pattern.matches(Patterns.GERMAN_ALPHANUMERIC_WITH_UNDERSCORE_AND_MINUS, "äbc123"); + + + //Assert + assertThat(valid, is(true)); + assertThat(validUnderscoreAtEnd, is(true)); + assertThat(validUnderscoreAtFront, is(true)); + assertThat(invalidSpace, is(false)); + assertThat(validMinus, is(true)); +===================================================================== +Found a 5 line (39 tokens) duplication in the following files: +Starting at line 260 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 275 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 275 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 254 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 254 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + .content(TestUtil.convertObjectToJsonBytes(concept)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); + + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); +===================================================================== +Found a 12 line (39 tokens) duplication in the following files: +Starting at line 64 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 49 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java +Starting at line 71 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 53 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 68 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 47 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/rest/SearchResourceTest.java +Starting at line 65 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 82 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + @Autowired + private JaversService javersService; + + private MockMvc mockMvc; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac).build(); + } + + @After + public void cleanUp() { +===================================================================== +Found a 10 line (39 tokens) duplication in the following files: +Starting at line 59 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAccessWaysResourceControllerTest.java +Starting at line 57 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 49 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/StudySeriesesResourceControllerTest.java +Starting at line 58 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java +Starting at line 57 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 67 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DaraServiceTest.java +Starting at line 44 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectLastReleaseResourceTest.java +Starting at line 44 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectReleasesResourceTest.java +Starting at line 60 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 57 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java +Starting at line 85 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + private MockMvc mockMvc; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac).build(); + } + + @After + public void cleanUp() { + dataAcquisitionProjectRepository.deleteAll(); +===================================================================== +Found a 7 line (39 tokens) duplication in the following files: +Starting at line 295 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 297 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 276 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 173 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/UserResourceTest.java + + "/api/data-packages/" + dataPackageAttachmentMetadata.getDataPackageId() + "/attachments")) + .andExpect(status().isOk()).andExpect(content().json("[]")); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER) + public void testCreateShadowCopyInstrumentAttachment() throws Exception { +===================================================================== +Found a 7 line (39 tokens) duplication in the following files: +Starting at line 373 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 374 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 144 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionImageResourceTest.java +Starting at line 352 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + String filename = DataPackageAttachmentFilenameBuilder.buildFileName(metadata); + try (InputStream is = new ByteArrayInputStream("Test".getBytes(StandardCharsets.UTF_8))) { + gridFsMetadataUpdateService.store(is, filename, "text/plain", metadata); + } + + mockMvc + .perform(delete( +===================================================================== +Found a 4 line (39 tokens) duplication in the following files: +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageShadowCopyServiceTest.java +Starting at line 94 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetShadowCopyServiceTest.java +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentShadowCopyServiceTest.java +Starting at line 79 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/service/DataAcquisitionProjectShadowCopyServiceTest.java +Starting at line 95 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionShadowCopyServiceTest.java +Starting at line 93 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyShadowCopyServiceTest.java +Starting at line 90 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/VariableShadowCopyServiceTest.java + + assertThat(shadowCopy.getId(), equalTo(master.getId() + "-" + release.getVersion())); + assertThat(shadowCopy.isShadow(), equalTo(true)); + assertThat(shadowCopy.getSuccessorId(), equalTo(null)); + assertThat(shadowCopy.getMasterId(), equalTo(master.getId())); +===================================================================== +Found a 5 line (39 tokens) duplication in the following files: +Starting at line 320 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 335 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java + + mockMvc.perform(post(API_DATASETS_URI) + .content(TestUtil.convertObjectToJsonBytes(dataSet)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) + .andExpect(jsonPath("$.errors[0].message", containsString("global.error.shadow-create-not-allowed"))); +===================================================================== +Found a 4 line (39 tokens) duplication in the following files: +Starting at line 295 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 309 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java + + mockMvc.perform(post(API_INSTRUMENTS_URI) + .content(TestUtil.convertObjectToJsonBytes(instrument)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) + .andExpect(jsonPath("$.errors[0].message", containsString("global.error.shadow-create-not-allowed"))); +===================================================================== +Found a 7 line (39 tokens) duplication in the following files: +Starting at line 177 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 236 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 298 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 353 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java + + public void testSimpleProjectForPostValidationWithWrongInformationForQuestion() throws IOException, Exception { + + //Arrange + //Project + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + project.getConfiguration().setDataPackagesState(new ProjectState(true, true)); + this.rdcProjectRepository.save(project); +===================================================================== +Found a 5 line (39 tokens) duplication in the following files: +Starting at line 470 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 484 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java + + mockMvc.perform(post(API_DATA_ACQUISITION_PROJECTS_URI) + .content(TestUtil.convertObjectToJsonBytes(project)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) + .andExpect(jsonPath("$.errors[0].message", containsString("global.error.shadow-create-not-allowed"))); +===================================================================== +Found a 8 line (39 tokens) duplication in the following files: +Starting at line 57 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/service/DataAcquisitionProjectVersionsServiceTest.java +Starting at line 71 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/service/DataAcquisitionProjectVersionsServiceTest.java + + assertNull(previousRelease); + + // unrelease + project.setRelease(null); + project = projectManagementService.save(project); + + previousRelease = versionsService.findPreviousRelease(project.getId(), null); + assertThat(previousRelease.getVersion(), equalTo("0.0.1")); +===================================================================== +Found a 9 line (39 tokens) duplication in the following files: +Starting at line 58 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/DeleteAllQuestionsResourceControllerTest.java +Starting at line 61 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/DeleteAllVariablesResourceControllerTest.java + + questionRepo.deleteAll(); + javersService.deleteAll(); + elasticsearchUpdateQueueItemRepository.deleteAll(); + elasticsearchAdminService.recreateAllIndices(); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.DATA_PROVIDER) + public void testDeleteAllQuestionsOfProject() throws Exception { +===================================================================== +Found a 4 line (39 tokens) duplication in the following files: +Starting at line 344 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 358 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java + + mockMvc.perform(post(API_QUESTIONS_URI) + .content(TestUtil.convertObjectToJsonBytes(question)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) + .andExpect(jsonPath("$.errors[0].message", containsString("global.error.shadow-create-not-allowed"))); +===================================================================== +Found a 5 line (39 tokens) duplication in the following files: +Starting at line 383 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 397 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + mockMvc.perform(post(API_SURVEYS_URI) + .content(TestUtil.convertObjectToJsonBytes(survey)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) + .andExpect(jsonPath("$.errors[0].message", containsString("global.error.shadow-create-not-allowed"))); +===================================================================== +Found a 8 line (39 tokens) duplication in the following files: +Starting at line 51 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/domain/UserTests.java +Starting at line 36 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/VariableTest.java + + boolean checkSameButDifferent = user1.equals(user1_1); + + // Assert + assertThat(checkNull, is(false)); + assertThat(checkClass, is(false)); + assertThat(checkSame, is(true)); + assertThat(checkDifferent, is(false)); + assertThat(checkSameButDifferent, is(true)); +===================================================================== +Found a 4 line (39 tokens) duplication in the following files: +Starting at line 119 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java +Starting at line 80 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/UserResourceTest.java + + restUserMockMvc.perform(get("/api/account").accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) + .andExpect(jsonPath("$.login").value("test")) +===================================================================== +Found a 5 line (39 tokens) duplication in the following files: +Starting at line 309 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 338 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 359 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 388 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 420 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 874 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 889 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + .perform(put(API_VARIABLES_URI + "/" + variable.getId()) + .content(TestUtil.convertObjectToJsonBytes(variable)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) + .andExpect(jsonPath("$.errors[0].message", containsString( +===================================================================== +Found a 7 line (39 tokens) duplication in the following files: +Starting at line 441 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 832 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 857 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + validResponse.setValue("hurz"); + + // create the variable with duplicate value classes + mockMvc + .perform(put(API_VARIABLES_URI + "/" + variable.getId()) + .content(TestUtil.convertObjectToJsonBytes(variable))) + .andExpect(status().is4xxClientError()).andReturn(); +===================================================================== +Found a 4 line (39 tokens) duplication in the following files: +Starting at line 868 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 882 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 899 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + public void testCreateVariableShadowCopy() throws Exception { + Variable variable = UnitTestCreateDomainObjectUtils.buildVariable("issue1991", 1, "varname", 1, + Collections.singletonList(1)); + variable.setId(variable.getId() + "-1.0.0"); +===================================================================== +Found a 5 line (39 tokens) duplication in the following files: +Starting at line 21 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/domain/QConcept.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSubDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSubDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSubDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSubDocument.java + + public static final QConcept concept = new QConcept("concept"); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractRdcDomainObject _super = new eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractRdcDomainObject(this); + + public final ListPath authors = this.createList("authors", eu.dzhw.fdz.metadatamanagement.common.domain.Person.class, eu.dzhw.fdz.metadatamanagement.common.domain.QPerson.class, PathInits.DIRECT2); +===================================================================== +Found a 3 line (39 tokens) duplication in the following files: +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/domain/QConcept.java +Starting at line 36 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 56 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSubDocument.java +Starting at line 49 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSubDocument.java + + public final ListPath authors = this.createList("authors", eu.dzhw.fdz.metadatamanagement.common.domain.Person.class, eu.dzhw.fdz.metadatamanagement.common.domain.QPerson.class, PathInits.DIRECT2); + + public final StringPath citationHint = createString("citationHint"); +===================================================================== +Found a 3 line (39 tokens) duplication in the following files: +Starting at line 36 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/domain/QConcept.java +Starting at line 39 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 41 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QDataSet.java +Starting at line 41 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java +Starting at line 24 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QPopulation.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString description = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("description")); + + public final StringPath doi = createString("doi"); +===================================================================== +Found a 4 line (39 tokens) duplication in the following files: +Starting at line 36 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QSubDataSet.java +Starting at line 43 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 53 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 54 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java + + public final ListPath dataCurators = this.createList("dataCurators", eu.dzhw.fdz.metadatamanagement.common.domain.Person.class, eu.dzhw.fdz.metadatamanagement.common.domain.QPerson.class, PathInits.DIRECT2); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString description = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("description")); +===================================================================== +Found a 4 line (39 tokens) duplication in the following files: +Starting at line 46 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 61 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 87 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 95 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 125 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 39 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSubDocument.java +Starting at line 53 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSubDocument.java +Starting at line 69 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationSearchDocument.java + + public final ListPath institutions = this.createList("institutions", eu.dzhw.fdz.metadatamanagement.common.domain.I18nString.class, eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString.class, PathInits.DIRECT2); + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; +===================================================================== +Found a 11 line (39 tokens) duplication in the following files: +Starting at line 46 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java +Starting at line 45 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSubDocument.java +Starting at line 41 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSubDocument.java +Starting at line 41 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySubDocument.java +Starting at line 48 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QSurvey.java + + public final StringPath id = createString("id"); + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + public final StringPath masterId = createString("masterId"); + + public final NumberPath number = createNumber("number", Integer.class); +===================================================================== +Found a 4 line (39 tokens) duplication in the following files: +Starting at line 71 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java +Starting at line 115 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java + + public final ListPath> surveyNumbers = this.>createList("surveyNumbers", Integer.class, NumberPath.class, PathInits.DIRECT2); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString title = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("title")); +===================================================================== +Found a 5 line (39 tokens) duplication in the following files: +Starting at line 21 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/ordermanagement/domain/QOrder.java +Starting at line 20 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/domain/QShadowCopyQueueItem.java +Starting at line 20 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/domain/QElasticsearchUpdateQueueItem.java + + public static final QOrder order = new QOrder("order"); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractRdcDomainObject _super = new eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractRdcDomainObject(this); + + public final EnumPath client = createEnum("client", OrderClient.class); +===================================================================== +Found a 13 line (39 tokens) duplication in the following files: +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptNestedDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageNestedDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetNestedDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentNestedDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionNestedDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationNestedDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveyNestedDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableNestedDocument.java + + public static final QConceptNestedDocument conceptNestedDocument = new QConceptNestedDocument("conceptNestedDocument"); + + public final QAbstractNestedSubDocument _super; + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString completeTitle; + + //inherited + public final StringPath createdBy; + + //inherited + public final DateTimePath createdDate; + + public final StringPath id = createString("id"); +===================================================================== +Found a 7 line (39 tokens) duplication in the following files: +Starting at line 93 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 137 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 115 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 127 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java + + public final eu.dzhw.fdz.metadatamanagement.conceptmanagement.domain.QTags tags = new eu.dzhw.fdz.metadatamanagement.conceptmanagement.domain.QTags(_super.tags); + + // custom + // inherited + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString title = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(_super.title); + + public final ListPath variables = this.createList("variables", VariableSubDocument.class, QVariableSubDocument.class, PathInits.DIRECT2); +===================================================================== +Found a 5 line (39 tokens) duplication in the following files: +Starting at line 70 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSubDocument.java +Starting at line 85 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSubDocument.java +Starting at line 87 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSubDocument.java +Starting at line 92 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySubDocument.java + + this.tags = inits.isInitialized("tags") ? new eu.dzhw.fdz.metadatamanagement.conceptmanagement.domain.QTags(forProperty("tags")) : null; + this.title = inits.isInitialized("title") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("title")) : null; + } + +} +===================================================================== +Found a 3 line (39 tokens) duplication in the following files: +Starting at line 85 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 93 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 67 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationSearchDocument.java + + public final ListPath nestedDataSets = this.createList("nestedDataSets", DataSetNestedDocument.class, QDataSetNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedInstitutions = this.createList("nestedInstitutions", eu.dzhw.fdz.metadatamanagement.common.domain.I18nString.class, eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString.class, PathInits.DIRECT2); +===================================================================== +Found a 3 line (39 tokens) duplication in the following files: +Starting at line 167 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 149 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 168 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 158 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java +Starting at line 181 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + this.configuration = inits.isInitialized("configuration") ? new eu.dzhw.fdz.metadatamanagement.projectmanagement.domain.QConfiguration(forProperty("configuration")) : null; + this.guiLabels = inits.isInitialized("guiLabels") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("guiLabels")) : null; + this.release = inits.isInitialized("release") ? new eu.dzhw.fdz.metadatamanagement.projectmanagement.domain.QRelease(forProperty("release")) : null; +===================================================================== +Found a 5 line (39 tokens) duplication in the following files: +Starting at line 84 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java +Starting at line 77 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 96 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 83 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java +Starting at line 113 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + public final ListPath nestedConcepts = this.createList("nestedConcepts", ConceptNestedDocument.class, QConceptNestedDocument.class, PathInits.DIRECT2); + + public final QDataPackageNestedDocument nestedDataPackage; + + public final ListPath nestedInstruments = this.createList("nestedInstruments", InstrumentNestedDocument.class, QInstrumentNestedDocument.class, PathInits.DIRECT2); +===================================================================== +Found a 5 line (39 tokens) duplication in the following files: +Starting at line 151 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 172 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 160 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java +Starting at line 184 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + this.nestedDataPackage = inits.isInitialized("nestedDataPackage") ? new QDataPackageNestedDocument(forProperty("nestedDataPackage"), inits.get("nestedDataPackage")) : null; + this.release = inits.isInitialized("release") ? new eu.dzhw.fdz.metadatamanagement.projectmanagement.domain.QRelease(forProperty("release")) : null; + } + +} +===================================================================== +Found a 12 line (39 tokens) duplication in the following files: +Starting at line 58 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 82 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + public final ListPath dataSets = this.createList("dataSets", DataSetSubDocument.class, QDataSetSubDocument.class, PathInits.DIRECT2); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString guiLabels; + + //inherited + public final BooleanPath hidden = _super.hidden; + + //inherited + public final StringPath id = _super.id; + + //inherited + public final NumberPath indexInInstrument = _super.indexInInstrument; +===================================================================== +Found a 4 line (38 tokens) duplication in the following files: +Starting at line 53 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/helper/DataPackageAttachmentShadowCopyDataSource.java +Starting at line 44 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/helper/DataSetShadowCopyDataSource.java +Starting at line 45 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/helper/InstrumentShadowCopyDataSource.java +Starting at line 45 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/helper/QuestionShadowCopyDataSource.java + + copy.setDataAcquisitionProjectId( + source.getDataAcquisitionProjectId() + "-" + release.getVersion()); + copy.setDataPackageId(source.getDataPackageId() + "-" + release.getVersion()); + copy.generateId(); +===================================================================== +Found a 4 line (38 tokens) duplication in the following files: +Starting at line 52 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/helper/DataSetAttachmentShadowCopyDataSource.java +Starting at line 47 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/helper/VariableShadowCopyDataSource.java + + copy.setDataAcquisitionProjectId( + source.getDataAcquisitionProjectId() + "-" + release.getVersion()); + copy.setDataSetId(source.getDataSetId() + "-" + release.getVersion()); + copy.generateId(); +===================================================================== +Found a 5 line (38 tokens) duplication in the following files: +Starting at line 76 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/helper/DataSetShadowCopyDataSource.java +Starting at line 78 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/helper/InstrumentShadowCopyDataSource.java +Starting at line 110 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/helper/VariableShadowCopyDataSource.java + + .filter(shadowCopy -> !dataSetRepository.existsById(shadowCopy.getMasterId())); + } + + private static List createDerivedSurveyIds(List surveyIds, String version) { + return surveyIds.stream().map(surveyId -> surveyId + "-" + version) +===================================================================== +Found a 5 line (38 tokens) duplication in the following files: +Starting at line 58 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/repository/DaraUpdateQueueItemRepositoryImpl.java +Starting at line 45 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/repository/ShadowCopyQueueRepositoryCustomImpl.java +Starting at line 46 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/repository/ElasticsearchUpdateQueueItemRepositoryImpl.java +Starting at line 68 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/repository/ElasticsearchUpdateQueueItemRepositoryImpl.java + + LocalDateTime updateStartedAt) { + Query query = new Query(new Criteria().andOperator(Criteria.where("updateStartedBy") + .is(updateStartedBy), + Criteria.where("updateStartedAt") + .is(updateStartedAt))).limit(BULK_SIZE) +===================================================================== +Found a 7 line (38 tokens) duplication in the following files: +Starting at line 34 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/repository/DataAcquisitionProjectRepositoryCustomImpl.java +Starting at line 49 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/repository/DataAcquisitionProjectRepositoryCustomImpl.java + + public List findAllMastersByIdLikeAndPublisherIdOrderByIdAsc( + String projectId, String dataProviderId) { + List dataProviderIdValues = Collections.singletonList(dataProviderId); + Criteria criteria = where("configuration.dataProviders") + .in(dataProviderIdValues) + .and("_id") + .regex(projectId, "i") +===================================================================== +Found a 16 line (38 tokens) duplication in the following files: +Starting at line 20 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/domain/validation/ValidQuestionIdNameValidator.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/domain/validation/ValidUniqueQuestionNumberValidator.java + + public void initialize(ValidQuestionIdName constraintAnnotation) {} + + /* + * (non-Javadoc) + * + * @see javax.validation.ConstraintValidator#isValid(java.lang.Object, + * javax.validation.ConstraintValidatorContext) + */ + @Override + public boolean isValid(Question question, ConstraintValidatorContext context) { + + if (question.isShadow()) { + return true; + } else { + // check precondition + if (question.getInstrumentId() == null || question.getNumber() == null) { +===================================================================== +Found a 3 line (38 tokens) duplication in the following files: +Starting at line 77 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResource.java +Starting at line 70 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResponseRateImageResource.java + + @RequestMapping(path = "/surveys/{surveyId}/attachments", method = RequestMethod.DELETE) + @Secured(value = {AuthoritiesConstants.PUBLISHER, AuthoritiesConstants.DATA_PROVIDER}) + public ResponseEntity deleteAllBySurveyId(@PathVariable("surveyId") String surveyId) { +===================================================================== +Found a 5 line (38 tokens) duplication in the following files: +Starting at line 69 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyResponseRateImageService.java +Starting at line 88 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyResponseRateImageService.java + + public void deleteSurveyImage(String surveyId, String fileName) throws IOException { + Optional survey = surveyRepository.findById(surveyId); + if (survey.isPresent() && survey.get().isShadow()) { + throw new ShadowCopyDeleteNotAllowedException(); + } +===================================================================== +Found a 13 line (38 tokens) duplication in the following files: +Starting at line 19 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/rest/I18nResourceControllerTest.java +Starting at line 15 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataFormatsResourceControllerTest.java +Starting at line 15 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveySampleTypesResourceControllerTest.java +Starting at line 15 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/UnitValuesResourceControllerTest.java + +public class I18nResourceControllerTest extends AbstractTest { + @Autowired + private WebApplicationContext wac; + + private MockMvc mockMvc; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac).build(); + } + + @Test + public void testGetCountryCodes() throws IOException, Exception { +===================================================================== +Found a 4 line (38 tokens) duplication in the following files: +Starting at line 308 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/unittesthelper/util/UnitTestCreateDomainObjectUtils.java +Starting at line 364 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java + + List surveyNumbers = new ArrayList<>(); + surveyNumbers.add(1); + List surveyIds = new ArrayList<>(); + surveyIds.add(UnitTestCreateValidIds.buildSurveyId(projectId, 1)); +===================================================================== +Found a 6 line (38 tokens) duplication in the following files: +Starting at line 120 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 131 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 152 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 163 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 184 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java + + conceptAttachmentMetadata.generateId(); + + // ensure that there is one file + mockMvc + .perform(get("/api/concepts/" + conceptAttachmentMetadata.getConceptId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(1))); +===================================================================== +Found a 3 line (38 tokens) duplication in the following files: +Starting at line 111 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java +Starting at line 126 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 135 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java +Starting at line 130 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 124 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 122 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java + + mockMvc.perform(get(API_CONCEPT_URI + "/" + concept.getId() + "/versions")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(equalTo(3)))) + .andExpect(jsonPath("$[0].id", is(concept.getId()))) +===================================================================== +Found a 10 line (38 tokens) duplication in the following files: +Starting at line 70 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAccessWaysResourceControllerTest.java +Starting at line 80 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java + + surveyRepository.deleteAll(); + dataPackageRepository.deleteAll(); + elasticsearchUpdateQueueItemRepository.deleteAll(); + elasticsearchAdminService.recreateAllIndices(); + javersService.deleteAll(); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER) + public void testGetAccessWaysOfDataPackage() throws IOException, Exception { +===================================================================== +Found a 7 line (38 tokens) duplication in the following files: +Starting at line 130 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 142 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 163 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 175 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 196 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java + + dataPackageAttachmentMetadata.generateId(); + + // ensure that there is one attachment + mockMvc + .perform(get("/api/data-packages/" + dataPackageAttachmentMetadata.getDataPackageId() + + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(1))); +===================================================================== +Found a 5 line (38 tokens) duplication in the following files: +Starting at line 221 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 111 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 107 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + .andExpect(jsonPath("$.[0].version", is(1))) + .andExpect(jsonPath("$.[0].createdBy", is("test"))) + .andExpect(jsonPath("$.[0].lastModifiedBy", is("test"))) + .andExpect(jsonPath("$.[0].masterId", + is("/public/files/data-packages/" + "stu-projectid$/attachments/filename.txt"))) +===================================================================== +Found a 8 line (38 tokens) duplication in the following files: +Starting at line 114 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 136 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 166 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 111 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 186 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 217 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 75 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java + + public void testUnreleasedNotPubliclyVisible() throws IOException, Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + DataPackage dataPackage = UnitTestCreateDomainObjectUtils.buildDataPackage(project.getId()); + + // create the dataPackage with the given id + mockMvc.perform(put(API_DATAPACKAGE_URI + "/" + dataPackage.getId()) +===================================================================== +Found a 3 line (38 tokens) duplication in the following files: +Starting at line 149 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 180 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 206 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 110 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 117 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 159 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 169 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 181 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + + mockMvc.perform(put("/api/data-acquisition-projects" + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isNoContent()); +===================================================================== +Found a 6 line (38 tokens) duplication in the following files: +Starting at line 148 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 170 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java + + public void testCreateDataPackageWithTooStudySeries() throws IOException, Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + this.dataAcquisitionProjectRepository.save(project); + + DataPackage dataPackage = UnitTestCreateDomainObjectUtils.buildDataPackage(project.getId()); + dataPackage.setStudySeries(I18nString.builder().de( +===================================================================== +Found a 5 line (38 tokens) duplication in the following files: +Starting at line 206 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 326 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java + + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().is2xxSuccessful()); + + // read the dataPackage under the new url + mockMvc.perform(get(API_DATAPACKAGE_URI + "/" + dataPackage.getId())).andExpect(status().isOk()) + .andExpect(jsonPath("$.id", is(dataPackage.getId()))) +===================================================================== +Found a 8 line (38 tokens) duplication in the following files: +Starting at line 150 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java +Starting at line 184 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java + + createTestFileForAttachment(master); + + DataPackageAttachmentMetadata shadow = createShadow(master, "1.0.0"); + createTestFileForAttachment(shadow); + release.setVersion("1.0.1"); + + shadowCopyService.createShadowCopies(dataAcquisitionProject.getId(), + dataAcquisitionProject.getRelease(), "1.0.0"); +===================================================================== +Found a 6 line (38 tokens) duplication in the following files: +Starting at line 131 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 142 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 164 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 175 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 196 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java + + dataSetAttachmentMetadata.generateId(); + + // ensure that there is one attachment + mockMvc + .perform(get("/api/data-sets/" + dataSetAttachmentMetadata.getDataSetId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(1)));; +===================================================================== +Found a 5 line (38 tokens) duplication in the following files: +Starting at line 97 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 131 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 251 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 280 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 78 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java +Starting at line 102 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java + + this.dataAcquisitionProjectRepository.save(project); + + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); + + DataSet dataSet = UnitTestCreateDomainObjectUtils.buildDataSet(project.getId(), survey.getId(), 1); +===================================================================== +Found a 3 line (38 tokens) duplication in the following files: +Starting at line 105 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 258 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 369 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 111 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java + + mockMvc.perform(put(API_DATASETS_URI + "/" + dataSet.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataSet)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 8 line (38 tokens) duplication in the following files: +Starting at line 176 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 194 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 248 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java + + public void testCreateDataSetWithWrongFormat() throws Exception { + // Arrange + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + this.dataAcquisitionProjectRepository.save(project); + + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); + + DataSet dataSet = UnitTestCreateDomainObjectUtils.buildDataSet(null, survey.getId(), 1); +===================================================================== +Found a 3 line (38 tokens) duplication in the following files: +Starting at line 288 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 86 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java + + mockMvc.perform(put(API_DATASETS_URI + "/" + dataSet.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataSet)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 8 line (38 tokens) duplication in the following files: +Starting at line 150 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java +Starting at line 184 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java + + createTestFileForAttachment(master); + + DataSetAttachmentMetadata shadow = createShadow(master, "1.0.0"); + createTestFileForAttachment(shadow); + release.setVersion("1.0.1"); + + shadowCopyService.createShadowCopies(dataAcquisitionProject.getId(), + dataAcquisitionProject.getRelease(), "1.0.0"); +===================================================================== +Found a 11 line (38 tokens) duplication in the following files: +Starting at line 39 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/filemanagement/rest/FileResourceTest.java +Starting at line 48 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/ordermanagement/rest/OrderResourceTest.java +Starting at line 90 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java + + private MockMvc mockMvc; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac) + .build(); + } + + @After + public void cleanUp() { + this.fileService.deleteTempFiles(); +===================================================================== +Found a 3 line (38 tokens) duplication in the following files: +Starting at line 94 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 156 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 196 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 271 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 83 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 106 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java + + mockMvc.perform(put(API_INSTRUMENTS_URI + "/" + instrument.getId()) + .content(TestUtil.convertObjectToJsonBytes(instrument)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 8 line (38 tokens) duplication in the following files: +Starting at line 153 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java +Starting at line 187 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java + + createTestFileForAttachment(master); + + InstrumentAttachmentMetadata shadow = createShadow(master, "1.0.0"); + createTestFileForAttachment(shadow); + release.setVersion("1.0.1"); + + shadowCopyService.createShadowCopies(dataAcquisitionProject.getId(), + dataAcquisitionProject.getRelease(), "1.0.0"); +===================================================================== +Found a 5 line (38 tokens) duplication in the following files: +Starting at line 162 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 219 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java + + ); + this.questionRepository.save(question); + QuestionImageMetadata questionImageMetadata = + UnitTestCreateDomainObjectUtils.buildQuestionImageMetadata(project.getId(), question.getId()); + UnitTestImageHelper.saveQuestionImage(this.questionImageService, questionImageMetadata); +===================================================================== +Found a 3 line (38 tokens) duplication in the following files: +Starting at line 96 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResourceTest.java +Starting at line 119 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResourceTest.java + + String projectId = createProject(); + this.mockMvc.perform(get(API_DATA_ACQUISITION_PROJECTS_URI + "/" + projectId + "/shadows")) + .andExpect(status().isOk()).andExpect(jsonPath("$.content.length()", is(0))); +===================================================================== +Found a 8 line (38 tokens) duplication in the following files: +Starting at line 88 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 120 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 147 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 171 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 210 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 236 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 260 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 277 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 294 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 312 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java + + public void testCreateQuestion() throws Exception { + + // Arrange + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + this.dataAcquisitionProjectRepository.save(project); + + Question question = UnitTestCreateDomainObjectUtils + .buildQuestion(project.getId(), 123, "instrument-Id"); +===================================================================== +Found a 8 line (38 tokens) duplication in the following files: +Starting at line 151 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionImageShadowCopyServiceTest.java +Starting at line 185 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionImageShadowCopyServiceTest.java + + createTestFileForAttachment(master); + + QuestionImageMetadata shadow = createShadow(master, "1.0.0"); + createTestFileForAttachment(shadow); + release.setVersion("1.0.1"); + + shadowCopyService.createShadowCopies(dataAcquisitionProject.getId(), + dataAcquisitionProject.getRelease(), "1.0.0"); +===================================================================== +Found a 3 line (38 tokens) duplication in the following files: +Starting at line 93 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 297 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 323 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 335 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 103 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java + + mockMvc.perform(put(API_SURVEYS_URI + "/" + survey.getId()) + .content(TestUtil.convertObjectToJsonBytes(survey)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 8 line (38 tokens) duplication in the following files: +Starting at line 147 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java +Starting at line 181 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java + + createTestFileForAttachment(master); + + SurveyAttachmentMetadata shadow = createShadow(master, "1.0.0"); + createTestFileForAttachment(shadow); + release.setVersion("1.0.1"); + + shadowCopyService.createShadowCopies(dataAcquisitionProject.getId(), + dataAcquisitionProject.getRelease(), "1.0.0"); +===================================================================== +Found a 6 line (38 tokens) duplication in the following files: +Starting at line 20 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/domain/QDaraUpdateQueueItem.java +Starting at line 21 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/domain/QRelatedPublication.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSubDocument.java +Starting at line 20 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationSubDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySubDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSubDocument.java +Starting at line 20 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/domain/QElasticsearchIndicesVersion.java + + public static final QDaraUpdateQueueItem daraUpdateQueueItem = new QDaraUpdateQueueItem("daraUpdateQueueItem"); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractRdcDomainObject _super = new eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractRdcDomainObject(this); + + //inherited + public final StringPath createdBy = _super.createdBy; +===================================================================== +Found a 7 line (38 tokens) duplication in the following files: +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSubDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/QVariable.java + + public final eu.dzhw.fdz.metadatamanagement.datapackagemanagement.domain.QDataPackage _super = new eu.dzhw.fdz.metadatamanagement.datapackagemanagement.domain.QDataPackage(this); + + public final ListPath accessWays = this.createList("accessWays", String.class, StringPath.class, PathInits.DIRECT2); + + // custom + // inherited + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(_super.annotations); +===================================================================== +Found a 3 line (38 tokens) duplication in the following files: +Starting at line 31 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 29 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 33 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 32 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationSearchDocument.java +Starting at line 29 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java +Starting at line 32 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(_super.annotations); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString completeTitle; +===================================================================== +Found a 8 line (38 tokens) duplication in the following files: +Starting at line 35 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetNestedDocument.java +Starting at line 35 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentNestedDocument.java +Starting at line 37 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSubDocument.java + + public final StringPath dataPackageId = createString("dataPackageId"); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString description; + + public final StringPath id = createString("id"); + + //inherited + public final StringPath lastModifiedBy; +===================================================================== +Found a 5 line (38 tokens) duplication in the following files: +Starting at line 55 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java +Starting at line 64 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString dataType = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(_super.dataType); + + // custom + // inherited + public final eu.dzhw.fdz.metadatamanagement.common.domain.QPeriod fieldPeriod = new eu.dzhw.fdz.metadatamanagement.common.domain.QPeriod(_super.fieldPeriod); +===================================================================== +Found a 5 line (37 tokens) duplication in the following files: +Starting at line 17 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/domain/ConceptAttachmentTypes.java +Starting at line 16 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/DataPackageAttachmentTypes.java + + public static final I18nString INSTRUMENT = new ImmutableI18nString("Instrument", "Instrument"); + public static final I18nString OTHER = new ImmutableI18nString("Sonstiges", "Other"); + + public static final Set ALL = Collections + .unmodifiableSet(new HashSet(Arrays.asList(DOCUMENTATION, INSTRUMENT, OTHER))); +===================================================================== +Found a 5 line (37 tokens) duplication in the following files: +Starting at line 42 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentVersionsResource.java +Starting at line 42 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentVersionsResource.java +Starting at line 42 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentVersionsResource.java +Starting at line 42 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentVersionsResource.java +Starting at line 41 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentVersionsResource.java + + public ResponseEntity findPreviousConceptAttachmentVersions(@PathVariable String conceptId, + @PathVariable String filename, + @RequestParam(name = "limit", defaultValue = "5") Integer limit, + @RequestParam(name = "skip", defaultValue = "0") Integer skip) { + List conceptAttachmentVersions = conceptAttachmentVersionsService +===================================================================== +Found a 4 line (37 tokens) duplication in the following files: +Starting at line 39 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResource.java +Starting at line 39 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResource.java +Starting at line 39 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResource.java +Starting at line 39 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResource.java +Starting at line 39 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResource.java +Starting at line 39 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResource.java + + public ResponseEntity findPreviousConceptVersions(@PathVariable String id, + @RequestParam(name = "limit", defaultValue = "5") Integer limit, + @RequestParam(name = "skip", defaultValue = "0") Integer skip) { + List conceptVersions = conceptVersionsService.findPreviousVersions(id, limit, skip); +===================================================================== +Found a 13 line (37 tokens) duplication in the following files: +Starting at line 210 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/DataPackage.java +Starting at line 191 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/DataSet.java +Starting at line 202 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/Instrument.java +Starting at line 130 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/domain/DataAcquisitionProject.java +Starting at line 235 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/domain/Question.java +Starting at line 214 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/Survey.java +Starting at line 344 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/Variable.java + + BeanUtils.copyProperties(dataPackage, this); + } + + @Override + protected void setMasterIdInternal(String masterId) { + this.masterId = masterId; + } + + @Override + protected void setIdInternal(String id) { + this.id = id; + } +} +===================================================================== +Found a 6 line (37 tokens) duplication in the following files: +Starting at line 80 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageOverviewService.java +Starting at line 132 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetReportService.java +Starting at line 444 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/service/DaraService.java + + try { + // Configuration, based on Freemarker Version 2.3.23 + Configuration templateConfiguration = new Configuration(Configuration.VERSION_2_3_23); + templateConfiguration.setDefaultEncoding(StandardCharsets.UTF_8.toString()); + templateConfiguration.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); + templateConfiguration.setNumberFormat("0.######"); +===================================================================== +Found a 5 line (37 tokens) duplication in the following files: +Starting at line 40 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/helper/DataPackageShadowCopyDataSource.java +Starting at line 41 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/helper/DataSetShadowCopyDataSource.java +Starting at line 42 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/helper/InstrumentShadowCopyDataSource.java +Starting at line 42 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/helper/QuestionShadowCopyDataSource.java +Starting at line 40 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/helper/SurveyShadowCopyDataSource.java + + DataPackage copy = crudHelper.read(derivedId).orElseGet(DataPackage::new); + BeanUtils.copyProperties(source, copy, "version"); + copy.setId(derivedId); + copy.setDataAcquisitionProjectId( + source.getDataAcquisitionProjectId() + "-" + release.getVersion()); +===================================================================== +Found a 13 line (37 tokens) duplication in the following files: +Starting at line 142 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/DataSetAttachmentMetadata.java +Starting at line 148 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/InstrumentAttachmentMetadata.java +Starting at line 139 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/domain/QuestionImageMetadata.java +Starting at line 141 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/SurveyAttachmentMetadata.java +Starting at line 106 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/SurveyResponseRateImageMetadata.java + + this.setId("/public/files/data-sets/" + dataSetId + "/attachments/" + fileName); + } + + @Override + protected void setMasterIdInternal(String masterId) { + this.masterId = masterId; + } + + @Override + protected void setIdInternal(String id) { + this.id = id; + } +} +===================================================================== +Found a 10 line (37 tokens) duplication in the following files: +Starting at line 209 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetManagementService.java +Starting at line 191 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentManagementService.java +Starting at line 223 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyManagementService.java + + if (!dataSetNumberExists(existingNumbers, i)) { + result.add(i); + } + } + result.add(max.get().getNumber() + 1); + } + return result; + } + + private boolean dataSetNumberExists(List dataSets, Integer number) { +===================================================================== +Found a 6 line (37 tokens) duplication in the following files: +Starting at line 211 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/unittesthelper/util/UnitTestCreateDomainObjectUtils.java +Starting at line 287 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/unittesthelper/util/UnitTestCreateDomainObjectUtils.java + + .build()) + .annotations(I18nString.builder().de("De Anmerkungen") + .en("En Annotations") + .build()) + .dataPackageId(UnitTestCreateValidIds.buildDataPackageId(projectId)) + .subDataSets(subDataSets) +===================================================================== +Found a 6 line (37 tokens) duplication in the following files: +Starting at line 135 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 167 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 146 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 179 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 146 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 179 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 127 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 94 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 137 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 164 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + .perform(get("/api/concepts/" + conceptAttachmentMetadata.getConceptId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(0))); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER, username = "test") +===================================================================== +Found a 4 line (37 tokens) duplication in the following files: +Starting at line 142 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 162 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java + + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().is2xxSuccessful()); + + // read the concept under the new url + mockMvc.perform(get(API_CONCEPT_URI + "/" + concept.getId())).andExpect(status().isOk()) +===================================================================== +Found a 7 line (37 tokens) duplication in the following files: +Starting at line 314 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 317 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 472 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 110 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionImageResourceTest.java +Starting at line 295 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 198 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResponseRateImageResourceTest.java + + .file(metadata)) + .andExpect(status().isBadRequest()).andExpect(jsonPath("$.errors[0].message", + containsString("global.error.shadow-create-not-allowed"))); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER) +===================================================================== +Found a 7 line (37 tokens) duplication in the following files: +Starting at line 329 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 332 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 144 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionImageResourceTest.java +Starting at line 310 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + String filename = DataPackageAttachmentFilenameBuilder.buildFileName(metadata); + try (InputStream is = new ByteArrayInputStream("Test".getBytes(StandardCharsets.UTF_8))) { + gridFsMetadataUpdateService.store(is, filename, "text/plain", metadata); + } + + mockMvc + .perform( +===================================================================== +Found a 4 line (37 tokens) duplication in the following files: +Starting at line 206 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 229 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java + + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().is2xxSuccessful()); + + // read the dataPackage under the new url + mockMvc.perform(get(API_DATAPACKAGE_URI + "/" + dataPackage.getId())).andExpect(status().isOk()) +===================================================================== +Found a 6 line (37 tokens) duplication in the following files: +Starting at line 263 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 298 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 373 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java + + mockMvc.perform(delete(API_DATASETS_URI + "/" + dataSet.getId())) + .andExpect(status().is2xxSuccessful()); + + // check that the DataSet has been deleted + mockMvc.perform(get(API_DATASETS_URI + "/" + dataSet.getId())) + .andExpect(status().isNotFound()); +===================================================================== +Found a 6 line (37 tokens) duplication in the following files: +Starting at line 168 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 280 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java + + .content(TestUtil.convertObjectToJsonBytes(instrument)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().is2xxSuccessful()); + + // read the updated instrument and check the version + mockMvc.perform(get(API_INSTRUMENTS_URI + "/" + instrument.getId())) + .andExpect(status().isOk()) +===================================================================== +Found a 5 line (37 tokens) duplication in the following files: +Starting at line 208 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 231 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 253 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 295 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java + + mockMvc.perform(put(API_INSTRUMENTS_URI + "/" + instrument.getId()) + .content(TestUtil.convertObjectToJsonBytes(instrument)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) + .andExpect( + jsonPath("$.errors[0].message", is("instrument-management.error.instrument.type.valid"))); +===================================================================== +Found a 4 line (37 tokens) duplication in the following files: +Starting at line 138 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DaraServiceTest.java +Starting at line 470 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 484 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java + + .perform(post("/api/data-acquisition-projects/" + project.getMasterId() + "/release") + .content(TestUtil.convertObjectToJsonBytes(project)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()).andExpect(jsonPath("$.errors[0].message", is( +===================================================================== +Found a 6 line (37 tokens) duplication in the following files: +Starting at line 479 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 493 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java + + public void testUpdateShadowCopyProject() throws Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + project.setId(project.getId() + "-1.0.0"); + project = rdcProjectRepository.save(project); + + mockMvc.perform(put(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) +===================================================================== +Found a 7 line (37 tokens) duplication in the following files: +Starting at line 129 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionImageResourceTest.java +Starting at line 119 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResponseRateImageResourceTest.java + + MockMvcRequestBuilders.multipart("/api/questions/images").file(attachment).file(metadata)) + .andExpect(status().isBadRequest()); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER) + public void testDeleteAllQuestionImagessOfShadowCopyQuestion() throws Exception { +===================================================================== +Found a 7 line (37 tokens) duplication in the following files: +Starting at line 191 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 326 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java + + .content(TestUtil.convertObjectToJsonBytes(question)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().is2xxSuccessful()); + + // read the updated Question and check the version + mockMvc + .perform(get(API_QUESTIONS_URI + "/" + question.getId())) + .andExpect(status().isOk()) +===================================================================== +Found a 6 line (37 tokens) duplication in the following files: +Starting at line 220 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 251 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java + + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().is2xxSuccessful()); + + // ASSERT + // read the related publication under the new url + mockMvc.perform(get(API_RELATED_PUBLICATION_URI + "/" + relatedPublication.getId())) + .andExpect(status().isOk()).andExpect(jsonPath("$.id", is(relatedPublication.getId()))) +===================================================================== +Found a 8 line (37 tokens) duplication in the following files: +Starting at line 62 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/domain/AuthorityTest.java +Starting at line 51 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/domain/UserTests.java +Starting at line 36 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/VariableTest.java + + boolean checkDifferent = authority1.equals(authority2); + + + // Assert + assertThat(checkNull, is(false)); + assertThat(checkClass, is(false)); + assertThat(checkSame, is(true)); + assertThat(checkDifferent, is(false)); +===================================================================== +Found a 6 line (37 tokens) duplication in the following files: +Starting at line 627 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 662 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 811 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + mockMvc.perform(delete(API_VARIABLES_URI + "/" + variable.getId())) + .andExpect(status().is2xxSuccessful()); + + // check that the variable has been deleted + mockMvc.perform(get(API_VARIABLES_URI + "/" + variable.getId())) + .andExpect(status().isNotFound()); +===================================================================== +Found a 5 line (37 tokens) duplication in the following files: +Starting at line 21 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/domain/QConcept.java +Starting at line 21 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/ordermanagement/domain/QOrder.java +Starting at line 20 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/domain/QDaraUpdateQueueItem.java +Starting at line 20 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/domain/QShadowCopyQueueItem.java +Starting at line 21 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/domain/QRelatedPublication.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QAbstractNestedSubDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSubDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSubDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSubDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSubDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSubDocument.java +Starting at line 20 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationSubDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySubDocument.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSubDocument.java +Starting at line 20 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/domain/QElasticsearchIndicesVersion.java +Starting at line 20 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/domain/QElasticsearchUpdateQueueItem.java +Starting at line 21 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/usermanagement/domain/QUser.java + + public static final QConcept concept = new QConcept("concept"); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractRdcDomainObject _super = new eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractRdcDomainObject(this); + + public final ListPath authors = this.createList("authors", eu.dzhw.fdz.metadatamanagement.common.domain.Person.class, eu.dzhw.fdz.metadatamanagement.common.domain.QPerson.class, PathInits.DIRECT2); +===================================================================== +Found a 3 line (37 tokens) duplication in the following files: +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/domain/QConcept.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSubDocument.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractRdcDomainObject _super = new eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractRdcDomainObject(this); + + public final ListPath authors = this.createList("authors", eu.dzhw.fdz.metadatamanagement.common.domain.Person.class, eu.dzhw.fdz.metadatamanagement.common.domain.QPerson.class, PathInits.DIRECT2); +===================================================================== +Found a 6 line (37 tokens) duplication in the following files: +Starting at line 21 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QDataSet.java +Starting at line 21 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java +Starting at line 20 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/domain/QDataAcquisitionProject.java +Starting at line 21 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/domain/QQuestion.java +Starting at line 20 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QSurvey.java +Starting at line 21 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/QVariable.java + + public static final QDataPackage dataPackage = new QDataPackage("dataPackage"); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractShadowableRdcDomainObject _super = new eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractShadowableRdcDomainObject(this); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("annotations")); +===================================================================== +Found a 11 line (37 tokens) duplication in the following files: +Starting at line 58 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/domain/QQuestion.java +Starting at line 68 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/QVariable.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString introduction = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("introduction")); + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + public final StringPath masterId = createString("masterId"); + + public final StringPath number = createString("number"); +===================================================================== +Found a 3 line (37 tokens) duplication in the following files: +Starting at line 68 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 67 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationSearchDocument.java + + public final ListPath nestedDataPackages = this.createList("nestedDataPackages", DataPackageNestedDocument.class, QDataPackageNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedDataSets = this.createList("nestedDataSets", DataSetNestedDocument.class, QDataSetNestedDocument.class, PathInits.DIRECT2); +===================================================================== +Found a 3 line (37 tokens) duplication in the following files: +Starting at line 70 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 85 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 81 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 87 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java + + public final ListPath nestedDataSets = this.createList("nestedDataSets", DataSetNestedDocument.class, QDataSetNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedInstruments = this.createList("nestedInstruments", InstrumentNestedDocument.class, QInstrumentNestedDocument.class, PathInits.DIRECT2); +===================================================================== +Found a 2 line (37 tokens) duplication in the following files: +Starting at line 122 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 167 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 149 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 168 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 111 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationSearchDocument.java +Starting at line 158 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java +Starting at line 181 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + this.completeTitle = inits.isInitialized("completeTitle") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("completeTitle")) : null; + this.guiLabels = inits.isInitialized("guiLabels") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("guiLabels")) : null; +===================================================================== +Found a 2 line (37 tokens) duplication in the following files: +Starting at line 70 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSubDocument.java +Starting at line 85 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSubDocument.java +Starting at line 87 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSubDocument.java +Starting at line 82 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveyNestedDocument.java + + this.tags = inits.isInitialized("tags") ? new eu.dzhw.fdz.metadatamanagement.conceptmanagement.domain.QTags(forProperty("tags")) : null; + this.title = inits.isInitialized("title") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("title")) : null; +===================================================================== +Found a 2 line (37 tokens) duplication in the following files: +Starting at line 168 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 151 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 172 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 160 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java +Starting at line 184 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + this.guiLabels = inits.isInitialized("guiLabels") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("guiLabels")) : null; + this.release = inits.isInitialized("release") ? new eu.dzhw.fdz.metadatamanagement.projectmanagement.domain.QRelease(forProperty("release")) : null; +===================================================================== +Found a 3 line (37 tokens) duplication in the following files: +Starting at line 104 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 123 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + public final ListPath nestedSurveys = this.createList("nestedSurveys", SurveyNestedDocument.class, QSurveyNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedVariables = this.createList("nestedVariables", VariableNestedDocument.class, QVariableNestedDocument.class, PathInits.DIRECT2); +===================================================================== +Found a 5 line (36 tokens) duplication in the following files: +Starting at line 76 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageOverviewResource.java +Starting at line 73 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetReportResource.java + + @PathVariable("dataPackageId") String dataPackageId, @PathVariable("version") String version, + HttpServletRequest request, + @RequestParam(name = "languages", defaultValue = "de") List languages) + throws IOException { + taskService.startReportTasks(dataPackageId, version, languages, +===================================================================== +Found a 5 line (36 tokens) duplication in the following files: +Starting at line 96 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentService.java +Starting at line 157 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentService.java +Starting at line 180 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentService.java + + DataPackageAttachmentMetadata metadata = mongoTemplate.getConverter() + .read(DataPackageAttachmentMetadata.class, file.getMetadata()); + if (metadata.isShadow()) { + throw new ShadowCopyDeleteNotAllowedException(); + } +===================================================================== +Found a 7 line (36 tokens) duplication in the following files: +Starting at line 207 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageManagementService.java +Starting at line 225 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetManagementService.java +Starting at line 208 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentManagementService.java +Starting at line 172 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionManagementService.java +Starting at line 238 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyManagementService.java + + public Optional read(String id) { + return crudHelper.read(id); + } + + @Override + @Secured(value = {AuthoritiesConstants.PUBLISHER, AuthoritiesConstants.DATA_PROVIDER}) + public void delete(DataPackage dataPackage) { +===================================================================== +Found a 8 line (36 tokens) duplication in the following files: +Starting at line 98 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageOverviewService.java +Starting at line 150 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetReportService.java + + String message = "data-package-management.error" + ".files-in-template-zip-incomplete"; + TemplateIncompleteException incompleteException = + new TemplateIncompleteException(message, missingTexFiles); + log.debug(message + missingTexFiles); + task = taskService.handleErrorTask(task, incompleteException); + return; + } + log.debug("Read the one file with freemarker code"); +===================================================================== +Found a 3 line (36 tokens) duplication in the following files: +Starting at line 53 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/helper/DataPackageAttachmentShadowCopyDataSource.java +Starting at line 43 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/helper/SurveyShadowCopyDataSource.java + + copy.setDataAcquisitionProjectId( + source.getDataAcquisitionProjectId() + "-" + release.getVersion()); + copy.setDataPackageId(source.getDataPackageId() + "-" + release.getVersion()); +===================================================================== +Found a 7 line (36 tokens) duplication in the following files: +Starting at line 74 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/helper/DataPackageShadowCopyDataSource.java +Starting at line 69 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/service/helper/DataAcquisitionProjectShadowCopyDataSource.java +Starting at line 74 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/helper/SurveyShadowCopyDataSource.java + + .filter(shadowCopy -> !dataPackageRepository.existsById(shadowCopy.getMasterId())); + } + + @Override + public void deleteExistingShadowCopies(String projectId, String version) { + String oldProjectId = projectId + "-" + version; + try (Stream dataPackages = dataPackageRepository +===================================================================== +Found a 5 line (36 tokens) duplication in the following files: +Starting at line 99 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentService.java +Starting at line 168 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentService.java +Starting at line 191 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentService.java + + DataSetAttachmentMetadata metadata = + mongoTemplate.getConverter().read(DataSetAttachmentMetadata.class, file.getMetadata()); + if (metadata.isShadow()) { + throw new ShadowCopyDeleteNotAllowedException(); + } +===================================================================== +Found a 5 line (36 tokens) duplication in the following files: +Starting at line 92 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentService.java +Starting at line 161 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentService.java +Starting at line 184 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentService.java + + InstrumentAttachmentMetadata metadata = + mongoTemplate.getConverter().read(InstrumentAttachmentMetadata.class, file.getMetadata()); + if (metadata.isShadow()) { + throw new ShadowCopyDeleteNotAllowedException(); + } +===================================================================== +Found a 3 line (36 tokens) duplication in the following files: +Starting at line 168 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentManagementService.java +Starting at line 197 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyManagementService.java + + Set instrumentIds = + questionRepository.streamIdsByConceptIdsContaining(concept.getId()) + .map(question -> question.getInstrumentId()).collect(Collectors.toSet()); +===================================================================== +Found a 9 line (36 tokens) duplication in the following files: +Starting at line 155 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java +Starting at line 361 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java + + return sendEmail(null, emailAddresses.toArray(new String[emailAddresses.size()]), null, null, + subject, content, false, true); + } + + /** + * Send a mail to users who were added as publishers to a project. + */ + @Async + public void sendPublishersAddedMail(List publishers, String projectId, String sender) { +===================================================================== +Found a 4 line (36 tokens) duplication in the following files: +Starting at line 44 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/repository/DaraUpdateQueueItemRepositoryImpl.java +Starting at line 60 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/repository/ElasticsearchUpdateQueueItemRepositoryImpl.java + + Query query = new Query(getUnlockedOrExpiredCriteria()).limit(BULK_SIZE); + Update update = new Update() + .set("updateStartedAt", updateStartedAt).set("updateStartedBy", updateStartedBy); + mongoOperations.updateMulti(query, update, DaraUpdateQueueItem.class); +===================================================================== +Found a 6 line (36 tokens) duplication in the following files: +Starting at line 53 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/DataPackageSearchDocument.java +Starting at line 45 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/DataSetSearchDocument.java +Starting at line 43 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/VariableSearchDocument.java + + private List nestedRelatedPublications = new ArrayList<>(); + + private List surveys = new ArrayList<>(); + private List nestedSurveys = new ArrayList<>(); + + private List questions = new ArrayList<>(); +===================================================================== +Found a 6 line (36 tokens) duplication in the following files: +Starting at line 56 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/DataPackageSearchDocument.java +Starting at line 43 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/DataSetSearchDocument.java +Starting at line 46 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/SurveySearchDocument.java + + private List nestedSurveys = new ArrayList<>(); + + private List questions = new ArrayList<>(); + private List nestedQuestions = new ArrayList<>(); + + private List instruments = new ArrayList<>(); +===================================================================== +Found a 6 line (36 tokens) duplication in the following files: +Starting at line 59 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/DataPackageSearchDocument.java +Starting at line 41 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/DataSetSearchDocument.java +Starting at line 44 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/SurveySearchDocument.java +Starting at line 46 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/VariableSearchDocument.java + + private List nestedQuestions = new ArrayList<>(); + + private List instruments = new ArrayList<>(); + private List nestedInstruments = new ArrayList<>(); + + private List concepts = new ArrayList<>(); +===================================================================== +Found a 5 line (36 tokens) duplication in the following files: +Starting at line 79 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentService.java +Starting at line 178 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentService.java + + SurveyAttachmentMetadata metadata = + mongoTemplate.getConverter().read(SurveyAttachmentMetadata.class, file.getMetadata()); + if (metadata.isShadow()) { + throw new ShadowCopyDeleteNotAllowedException(); + } +===================================================================== +Found a 4 line (36 tokens) duplication in the following files: +Starting at line 122 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyResponseRateImageService.java +Starting at line 134 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyResponseRateImageService.java + + private String getResponseRateFileNameGerman(String surveyId) { + String[] surveyNumberWithDollar = surveyId.split("-sy"); + String[] surveyNumber = surveyNumberWithDollar[1].split("\\$"); + return surveyNumber[0] + "_responserate_de"; +===================================================================== +Found a 5 line (36 tokens) duplication in the following files: +Starting at line 307 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/unittesthelper/util/UnitTestCreateDomainObjectUtils.java +Starting at line 404 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/unittesthelper/util/UnitTestCreateDomainObjectUtils.java + + public static Instrument buildInstrument(String projectId, Integer instrumentNumber) { + List surveyNumbers = new ArrayList<>(); + surveyNumbers.add(1); + List surveyIds = new ArrayList<>(); + surveyIds.add(UnitTestCreateValidIds.buildSurveyId(projectId, 1)); +===================================================================== +Found a 19 line (36 tokens) duplication in the following files: +Starting at line 73 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/unittesthelper/util/UnitTestUserManagementUtils.java +Starting at line 91 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/unittesthelper/util/UnitTestUserManagementUtils.java + + public static void login(String login, String password) { + // Empty Context (no user is logged) + SecurityContext securityContextEmpty = SecurityContextHolder.createEmptyContext(); + + // Login (!) + securityContextEmpty + .setAuthentication(new UsernamePasswordAuthenticationToken(login, password)); + + // Set Context with logged user. + SecurityContextHolder.setContext(securityContextEmpty); + } + + /** + * This helper methods log a account into the application by customuserdetails and password + * + * @param login + * @param password + */ + public static void login(CustomUserDetails login, String password) { +===================================================================== +Found a 11 line (36 tokens) duplication in the following files: +Starting at line 60 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 71 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 71 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 74 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 56 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 62 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionImageResourceTest.java +Starting at line 71 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 70 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 69 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResponseRateImageResourceTest.java + + private MockMvc mockMvc; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac) + .build(); + } + + @After + public void cleanUp() { + this.conceptRepository.deleteAll(); +===================================================================== +Found a 6 line (36 tokens) duplication in the following files: +Starting at line 124 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 156 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 134 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 167 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 135 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 168 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 115 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 191 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 128 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 155 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + .perform(get("/api/concepts/" + conceptAttachmentMetadata.getConceptId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(1))); + + // delete the file + mockMvc + .perform(delete("/api/concepts/" + conceptAttachmentMetadata.getConceptId() +===================================================================== +Found a 6 line (36 tokens) duplication in the following files: +Starting at line 131 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 163 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 200 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java + + .andExpect(status().is2xxSuccessful()); + + // ensure the uploaded file does not exist anymore + mockMvc + .perform(get("/api/concepts/" + conceptAttachmentMetadata.getConceptId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(0))); +===================================================================== +Found a 4 line (36 tokens) duplication in the following files: +Starting at line 197 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 83 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentVersionsResourceTest.java +Starting at line 208 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 209 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 83 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentVersionsResourceTest.java +Starting at line 156 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 83 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentVersionsResourceTest.java +Starting at line 191 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 81 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentVersionsResourceTest.java + + .perform(put("/api/concepts/" + conceptAttachmentMetadata.getConceptId() + "/attachments/" + + attachment.getOriginalFilename()).content(TestUtil.convertObjectToJsonBytes(current)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isNoContent()); +===================================================================== +Found a 3 line (36 tokens) duplication in the following files: +Starting at line 259 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 90 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 130 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 157 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 72 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java +Starting at line 92 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java + + mockMvc.perform(put("/api/concepts/" + concept.getId()) + .content(TestUtil.convertObjectToJsonBytes(concept)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 3 line (36 tokens) duplication in the following files: +Starting at line 125 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java +Starting at line 143 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 139 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 131 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java + + .andExpect(jsonPath("$[2].id", is(concept.getId()))) + .andExpect(jsonPath("$[2].version", is(equalTo(0)))) + .andExpect(jsonPath("$[2].title.de", is(firstTitle))) +===================================================================== +Found a 8 line (36 tokens) duplication in the following files: +Starting at line 61 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAccessWaysResourceControllerTest.java +Starting at line 59 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 52 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DeleteAllDataPackagesResourceControllerTest.java +Starting at line 51 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/StudySeriesesResourceControllerTest.java +Starting at line 60 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java +Starting at line 53 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DeleteAllDateSetsResourceControllerTest.java +Starting at line 56 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/DeleteAllInstrumentsResourceControllerTest.java +Starting at line 59 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 69 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DaraServiceTest.java +Starting at line 46 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectLastReleaseResourceTest.java +Starting at line 46 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectReleasesResourceTest.java +Starting at line 62 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 50 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/DeleteAllQuestionsResourceControllerTest.java +Starting at line 54 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/DeleteAllSurveysResourceControllerTest.java +Starting at line 59 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java +Starting at line 53 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/DeleteAllVariablesResourceControllerTest.java +Starting at line 87 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac).build(); + } + + @After + public void cleanUp() { + dataAcquisitionProjectRepository.deleteAll(); +===================================================================== +Found a 3 line (36 tokens) duplication in the following files: +Starting at line 274 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 121 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 143 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 173 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 199 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 96 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 193 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 224 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 82 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 107 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java + + mockMvc.perform(put("/api/data-packages/" + dataPackage.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataPackage)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); +===================================================================== +Found a 6 line (36 tokens) duplication in the following files: +Starting at line 380 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 379 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 357 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + "/api/data-packages/" + dataPackageId + "/attachments/" + metadata.getFileName())) + .andExpect(status().isBadRequest()).andExpect(jsonPath("$.errors[0].message", + containsString("global.error.shadow-delete-not-allowed"))); + } + +} +===================================================================== +Found a 4 line (36 tokens) duplication in the following files: +Starting at line 128 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 154 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java + + .andExpect(jsonPath("$.content.length()", is(0))); + // ensure that there are still no pinned data packages + mockMvc.perform(get(API_DATAPACKAGE_URI + "?pinned=true")).andExpect(status().isOk()) + .andExpect(jsonPath("$.content.length()", is(0))); +===================================================================== +Found a 6 line (36 tokens) duplication in the following files: +Starting at line 130 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 239 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java + + public void testCreateHiddenDataPackage() throws IOException, Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + DataPackage dataPackage = UnitTestCreateDomainObjectUtils.buildDataPackage(project.getId()); + dataPackage.setHidden(true); +===================================================================== +Found a 7 line (36 tokens) duplication in the following files: +Starting at line 269 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 284 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java + + public void testUpdateShadowCopyDataPackage() throws Exception { + DataPackage dataPackage = UnitTestCreateDomainObjectUtils.buildDataPackage("issue1991"); + dataPackage.setId(dataPackage.getId() + "-1.0.0"); + dataPackageRepository.save(dataPackage); + + mockMvc + .perform(put(API_DATAPACKAGE_URI + "/" + dataPackage.getId()) +===================================================================== +Found a 4 line (36 tokens) duplication in the following files: +Starting at line 138 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java +Starting at line 138 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java +Starting at line 139 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionImageShadowCopyServiceTest.java +Starting at line 135 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java + + mongoTemplate.getConverter().read(DataPackageAttachmentMetadata.class, shadowFile.getMetadata()); + + assertThat(metadata.getSuccessorId(), nullValue()); + assertThat(shadowFile.getMetadata().get("_contentType"), equalTo("text/plain")); +===================================================================== +Found a 6 line (36 tokens) duplication in the following files: +Starting at line 152 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java +Starting at line 186 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java +Starting at line 189 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java +Starting at line 187 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionImageShadowCopyServiceTest.java +Starting at line 183 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java + + DataPackageAttachmentMetadata shadow = createShadow(master, "1.0.0"); + createTestFileForAttachment(shadow); + release.setVersion("1.0.1"); + + shadowCopyService.createShadowCopies(dataAcquisitionProject.getId(), + dataAcquisitionProject.getRelease(), "1.0.0"); +===================================================================== +Found a 6 line (36 tokens) duplication in the following files: +Starting at line 186 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java +Starting at line 152 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java +Starting at line 155 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java +Starting at line 153 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionImageShadowCopyServiceTest.java +Starting at line 149 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java + + DataPackageAttachmentMetadata shadow = createShadow(master, "1.0.0"); + createTestFileForAttachment(shadow); + release.setVersion("1.0.1"); + + shadowCopyService.createShadowCopies(dataAcquisitionProject.getId(), + dataAcquisitionProject.getRelease(), "1.0.0"); +===================================================================== +Found a 6 line (36 tokens) duplication in the following files: +Starting at line 142 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 175 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 212 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java + + .andExpect(status().is2xxSuccessful()); + + // ensure the uploaded file does not exist anymore + mockMvc + .perform(get("/api/data-sets/" + dataSetAttachmentMetadata.getDataSetId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(0))); +===================================================================== +Found a 7 line (36 tokens) duplication in the following files: +Starting at line 227 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 247 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java + + public void testUploadAttachmentWithWrongLanguage() throws Exception { + + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); + DataSetAttachmentMetadata dataSetAttachmentMetadata = UnitTestCreateDomainObjectUtils + .buildDataSetAttachmentMetadata("projectid", 1); + dataSetAttachmentMetadata.setLanguage("test"); +===================================================================== +Found a 3 line (36 tokens) duplication in the following files: +Starting at line 274 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 105 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 258 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 288 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 369 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 86 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java +Starting at line 111 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java + + mockMvc.perform(put("/api/data-sets/" + dataSet.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataSet)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 6 line (36 tokens) duplication in the following files: +Starting at line 107 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 141 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 299 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java + + .andExpect(status().isCreated()); + + // check that auditing attributes have been set + mockMvc.perform(get(API_DATASETS_URI + "/" + dataSet.getId())) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.createdDate", not(isEmptyOrNullString()))) +===================================================================== +Found a 5 line (36 tokens) duplication in the following files: +Starting at line 140 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 86 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java + + mockMvc.perform(post(API_DATASETS_URI).content(TestUtil.convertObjectToJsonBytes(dataSet)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); + + // check that auditing attributes have been set + mockMvc.perform(get(API_DATASETS_URI + "/" + dataSet.getId())).andExpect(status().isOk()) +===================================================================== +Found a 9 line (36 tokens) duplication in the following files: +Starting at line 84 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 122 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 198 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java + + .file(attachment).file(metadata)).andExpect(status().isCreated()); + + // read the created attachment and check the version + mockMvc + .perform(get( + "/api/instruments/" + instrumentAttachmentMetadata.getInstrumentId() + "/attachments")) + .andExpect(status().isOk()) + .andExpect( + jsonPath("$.[0].instrumentId", is(instrumentAttachmentMetadata.getInstrumentId()))) +===================================================================== +Found a 7 line (36 tokens) duplication in the following files: +Starting at line 110 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 142 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 160 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 186 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java + + .file(attachment).file(metadata)).andExpect(status().isCreated()); + + // ensure the uploaded file exists + mockMvc + .perform(get( + "/api/instruments/" + instrumentAttachmentMetadata.getInstrumentId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(1))); +===================================================================== +Found a 7 line (36 tokens) duplication in the following files: +Starting at line 209 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 228 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java + + public void testUploadAttachmentWithWrongType() throws Exception { + + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); + InstrumentAttachmentMetadata instrumentAttachmentMetadata = + UnitTestCreateDomainObjectUtils.buildInstrumentAttachmentMetadata("projectid", 1); + instrumentAttachmentMetadata.setType(new I18nString("hurz", "hurz")); +===================================================================== +Found a 3 line (36 tokens) duplication in the following files: +Starting at line 253 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 94 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 156 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 196 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 271 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 83 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 106 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java + + mockMvc.perform(put("/api/instruments/" + instrument.getId()) + .content(TestUtil.convertObjectToJsonBytes(instrument)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); +===================================================================== +Found a 11 line (36 tokens) duplication in the following files: +Starting at line 63 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 68 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java + + @Autowired + private ElasticsearchAdminService elasticsearchAdminService; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac) + .build(); + } + + @After + public void cleanUp() { +===================================================================== +Found a 9 line (36 tokens) duplication in the following files: +Starting at line 114 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 433 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java + + buildValidProject(); + + // Act & Assert + mockMvc.perform(post(API_DATA_ACQUISITION_PROJECTS_POST_VALIDATION_URI)) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.errors", hasSize(0)));//no errors + } + + private DataAcquisitionProject buildValidProject() { +===================================================================== +Found a 6 line (36 tokens) duplication in the following files: +Starting at line 416 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 432 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java + + applyNotReadyState(dataAcquisitionProject); + rdcProjectRepository.save(dataAcquisitionProject); + + mockMvc.perform(post(API_DATA_ACQUISITION_PROJECTS_POST_VALIDATION_URI)) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.errors", hasSize(1))) +===================================================================== +Found a 8 line (36 tokens) duplication in the following files: +Starting at line 71 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 70 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac).build(); + } + + @After + public void cleanUp() { + rdcProjectRepository.deleteAll(); +===================================================================== +Found a 10 line (36 tokens) duplication in the following files: +Starting at line 80 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResourceTest.java +Starting at line 64 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + + greenMail.start(); + } + + @After + public void cleanUp() { + dataAcquisitionProjectRepository.deleteAll(); + shadowCopyQueueItemRepository.deleteAll(); + elasticsearchUpdateQueueItemRepository.deleteAll(); + elasticsearchAdminService.recreateAllIndices(); + javersService.deleteAll(); +===================================================================== +Found a 5 line (36 tokens) duplication in the following files: +Starting at line 108 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResourceTest.java +Starting at line 150 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResourceTest.java +Starting at line 173 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResourceTest.java + + .andExpect(status().isNotFound()); + + this.mockMvc + .perform(get(API_DATA_ACQUISITION_PROJECTS_URI + "/" + projectId + "/shadows/1.0.0/action")) + .andExpect(status().isOk()).andExpect(jsonPath("$.size()", is(0))); +===================================================================== +Found a 7 line (36 tokens) duplication in the following files: +Starting at line 100 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 125 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 134 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 152 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 161 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 179 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 194 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + .andExpect(status().isCreated()); + + // read the created attachment and check the version + mockMvc.perform( + get("/api/surveys/" + surveyAttachmentMetadata.getSurveyId() + "/attachments")) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.[0].surveyId", is(surveyAttachmentMetadata.getSurveyId()))) +===================================================================== +Found a 7 line (36 tokens) duplication in the following files: +Starting at line 207 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 227 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 283 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + public void testUploadAttachmentWithWrongLanguage() throws Exception { + + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); + SurveyAttachmentMetadata surveyAttachmentMetadata = UnitTestCreateDomainObjectUtils + .buildSurveyAttachmentMetadata("projectid", 1); + surveyAttachmentMetadata.setLanguage("test"); +===================================================================== +Found a 3 line (36 tokens) duplication in the following files: +Starting at line 253 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 93 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 297 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 323 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 335 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 82 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java +Starting at line 103 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java + + mockMvc.perform(put("/api/surveys/" + survey.getId()) + .content(TestUtil.convertObjectToJsonBytes(survey)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 8 line (36 tokens) duplication in the following files: +Starting at line 86 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 111 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 290 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 316 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + public void testCreateValidSurvey() throws Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + rdcProjectRepository.save(project); + + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); + + // create the survey with the given id + mockMvc.perform(put(API_SURVEYS_URI + "/" + survey.getId()) +===================================================================== +Found a 5 line (36 tokens) duplication in the following files: +Starting at line 118 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 82 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java + + mockMvc.perform(post(API_SURVEYS_URI).content(TestUtil.convertObjectToJsonBytes(survey)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); + + // read the survey under the new url + mockMvc.perform(get(API_SURVEYS_URI + "/" + survey.getId())).andExpect(status().isOk()); +===================================================================== +Found a 6 line (36 tokens) duplication in the following files: +Starting at line 131 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 146 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + public void testCreateSurveyWithMixedMethodDataType() throws Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + rdcProjectRepository.save(project); + + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); + survey.setDataType(I18nString.builder().de("Mixed Methods").en("Mixed Methods").build()); +===================================================================== +Found a 6 line (36 tokens) duplication in the following files: +Starting at line 392 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 406 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + public void testUpdateShadowCopySurvey() throws Exception { + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey("issue1991"); + survey.setId(survey.getId() + "-1.0.0"); + surveyRepository.save(survey); + + mockMvc.perform(put(API_SURVEYS_URI + "/" + survey.getId()) +===================================================================== +Found a 7 line (36 tokens) duplication in the following files: +Starting at line 179 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java +Starting at line 193 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java + + UnitTestUserManagementUtils.login(user.getLogin(), user.getPassword()); + + // Act + + // Assert + this.restMvc.perform(post("/api/account").contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(dto))).andExpect(status().isOk()); +===================================================================== +Found a 8 line (36 tokens) duplication in the following files: +Starting at line 240 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java +Starting at line 266 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java + + dto.setNewPassword("newPassword"); + + // Act + + // Assert + this.restMvc.perform(post("/api/account/reset-password/finish") + .contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(dto))) + .andExpect(status().isOk()); +===================================================================== +Found a 11 line (36 tokens) duplication in the following files: +Starting at line 20 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/common/domain/QAbstractShadowableRdcDomainObject.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/common/domain/QTask.java + + public static final QAbstractShadowableRdcDomainObject abstractShadowableRdcDomainObject = new QAbstractShadowableRdcDomainObject("abstractShadowableRdcDomainObject"); + + public final QAbstractRdcDomainObject _super = new QAbstractRdcDomainObject(this); + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + public final BooleanPath hidden = createBoolean("hidden"); +===================================================================== +Found a 9 line (36 tokens) duplication in the following files: +Starting at line 33 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/common/domain/QAbstractShadowableRdcDomainObject.java +Starting at line 66 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java + + public final StringPath id = _super.id; + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + public final StringPath masterId = createString("masterId"); +===================================================================== +Found a 9 line (36 tokens) duplication in the following files: +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/common/domain/QTask.java +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/domain/QConcept.java + + public final QAbstractRdcDomainObject _super = new QAbstractRdcDomainObject(this); + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + public final eu.dzhw.fdz.metadatamanagement.common.rest.errors.QErrorListDto errorList; +===================================================================== +Found a 11 line (36 tokens) duplication in the following files: +Starting at line 28 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QDataSet.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java +Starting at line 24 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/domain/QShadowCopyQueueItem.java +Starting at line 31 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/domain/QQuestion.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSubDocument.java +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSubDocument.java +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSubDocument.java +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSubDocument.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySubDocument.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSubDocument.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QSurvey.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/QVariable.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("annotations")); + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + public final StringPath dataAcquisitionProjectId = createString("dataAcquisitionProjectId"); + + public final StringPath dataPackageId = createString("dataPackageId"); +===================================================================== +Found a 11 line (36 tokens) duplication in the following files: +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/ordermanagement/domain/QOrder.java +Starting at line 22 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/domain/QDaraUpdateQueueItem.java +Starting at line 22 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/domain/QElasticsearchIndicesVersion.java + + public final EnumPath client = createEnum("client", OrderClient.class); + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + public final StringPath id = createString("id"); + + public final StringPath languageKey = createString("languageKey"); +===================================================================== +Found a 6 line (36 tokens) duplication in the following files: +Starting at line 55 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 66 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java +Starting at line 70 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java + + public final StringPath id = _super.id; + + public final ListPath instruments = this.createList("instruments", InstrumentSubDocument.class, QInstrumentSubDocument.class, PathInits.DIRECT2); + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; +===================================================================== +Found a 10 line (36 tokens) duplication in the following files: +Starting at line 61 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 64 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString guiLabels; + + //inherited + public final BooleanPath hidden = _super.hidden; + + //inherited + public final StringPath id = _super.id; + + //inherited + public final ListPath institutions = _super.institutions; +===================================================================== +Found a 7 line (36 tokens) duplication in the following files: +Starting at line 116 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java +Starting at line 153 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + public final ListPath> surveyNumbers; + + public final ListPath surveys = this.createList("surveys", SurveySubDocument.class, QSurveySubDocument.class, PathInits.DIRECT2); + + // custom + // inherited + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString type; +===================================================================== +Found a 11 line (36 tokens) duplication in the following files: +Starting at line 43 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSubDocument.java +Starting at line 68 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/QVariable.java + + public final NumberPath instrumentNumber = createNumber("instrumentNumber", Integer.class); + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + public final StringPath masterId = createString("masterId"); + + public final StringPath number = createString("number"); +===================================================================== +Found a 1 line (36 tokens) duplication in the following files: +Starting at line 55 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSubDocument.java +Starting at line 55 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSubDocument.java + + public final ListPath> relatedQuestions = this.>createList("relatedQuestions", eu.dzhw.fdz.metadatamanagement.variablemanagement.domain.projections.RelatedQuestionSubDocumentProjection.class, SimplePath.class, PathInits.DIRECT2); +===================================================================== +Found a 7 line (35 tokens) duplication in the following files: +Starting at line 191 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/service/GenericDomainObjectCrudHelper.java +Starting at line 140 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/service/GenericShadowableDomainObjectCrudHelper.java + + repository.delete(domainObject); + if (elasticsearchType != null) { + elasticsearchUpdateQueueService.enqueue(domainObject.getId(), this.elasticsearchType, + ElasticsearchUpdateQueueAction.DELETE); + // flush the current changes + elasticsearchUpdateQueueService.processQueueItems(this.elasticsearchType); + } +===================================================================== +Found a 5 line (35 tokens) duplication in the following files: +Starting at line 59 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptAttachmentVersionsService.java +Starting at line 60 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentVersionsService.java +Starting at line 61 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentVersionsService.java +Starting at line 62 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentVersionsService.java +Starting at line 67 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentVersionsService.java + + Stream> shadows = + javers.findShadowsAndStream(jqlQuery.build()); + shadows = shadows.skip(skip).limit(limit); + + return shadows.map(shadow -> { +===================================================================== +Found a 13 line (35 tokens) duplication in the following files: +Starting at line 210 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/DataPackage.java +Starting at line 191 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/DataSet.java +Starting at line 142 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/DataSetAttachmentMetadata.java +Starting at line 202 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/Instrument.java +Starting at line 148 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/InstrumentAttachmentMetadata.java +Starting at line 130 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/domain/DataAcquisitionProject.java +Starting at line 235 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/domain/Question.java +Starting at line 139 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/domain/QuestionImageMetadata.java +Starting at line 214 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/Survey.java +Starting at line 141 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/SurveyAttachmentMetadata.java +Starting at line 106 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/SurveyResponseRateImageMetadata.java +Starting at line 344 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/Variable.java + + BeanUtils.copyProperties(dataPackage, this); + } + + @Override + protected void setMasterIdInternal(String masterId) { + this.masterId = masterId; + } + + @Override + protected void setIdInternal(String id) { + this.id = id; + } +} +===================================================================== +Found a 5 line (35 tokens) duplication in the following files: +Starting at line 30 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DaraOaiPmhClient.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataCiteClient.java + + public DaraOaiPmhClient() { + restTemplate = new RestTemplate(new HttpComponentsClientHttpRequestFactory()); + restTemplate.getMessageConverters().add(0, + new StringHttpMessageConverter(Charset.forName("UTF-8"))); + } +===================================================================== +Found a 9 line (35 tokens) duplication in the following files: +Starting at line 175 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageOverviewService.java +Starting at line 272 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetReportService.java +Starting at line 468 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/service/DaraService.java + + ESCAPE_PREFIX + templateContent + ESCAPE_SUFFIX, templateConfiguration); + + try (Writer stringWriter = new StringWriter()) { + texTemplate.process(dataForTemplate, stringWriter); + + stringWriter.flush(); + return stringWriter.toString(); + } + } +===================================================================== +Found a 5 line (35 tokens) duplication in the following files: +Starting at line 136 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetManagementService.java +Starting at line 153 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetManagementService.java +Starting at line 187 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetManagementService.java + + variableRepository.streamIdsByRelatedQuestionsQuestionId(question.getId()) + .map(variable -> variable.getDataSetId()).collect(Collectors.toSet()); + return dataSetRepository.streamIdsByIdIn(dataSetIds); + }, ElasticsearchType.data_sets); + } +===================================================================== +Found a 16 line (35 tokens) duplication in the following files: +Starting at line 20 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/validation/ValidInstrumentIdPatternValidator.java +Starting at line 30 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/validation/ValidUniqueInstrumentNumberValidator.java + + public void initialize(ValidInstrumentIdPattern constraintAnnotation) {} + + /* + * (non-Javadoc) + * + * @see javax.validation.ConstraintValidator#isValid(java.lang.Object, + * javax.validation.ConstraintValidatorContext) + */ + @Override + public boolean isValid(Instrument instrument, ConstraintValidatorContext context) { + + if (instrument.isShadow()) { + return true; + } else { + // check precondition + if (instrument.getDataAcquisitionProjectId() == null || instrument.getId() == null +===================================================================== +Found a 9 line (35 tokens) duplication in the following files: +Starting at line 140 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java +Starting at line 361 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java + + return sendEmail(null, emailAddresses.toArray(new String[emailAddresses.size()]), null, null, + subject, content, false, true); + } + + /** + * Send an mail, if an automatic update to dara was not successful. + */ + @Async + public Future sendMailOnDaraAutomaticUpdateError(List admins, String projectId) { +===================================================================== +Found a 5 line (35 tokens) duplication in the following files: +Starting at line 200 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchAdminService.java +Starting at line 218 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchAdminService.java + + resourceLoader.getResource("classpath:elasticsearch/settings.json").getInputStream(); + Reader reader = new InputStreamReader(inputStream, "UTF-8");) { + return FileCopyUtils.copyToString(reader); + } catch (IOException e) { + throw new RuntimeException("Unable to load settings!", e); +===================================================================== +Found a 7 line (35 tokens) duplication in the following files: +Starting at line 346 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 433 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 472 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 542 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java +Starting at line 635 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java + + projectRepository.findById(instrument.getDataAcquisitionProjectId()).orElse(null); + if (project == null) { + // project has been deleted, skip upsert + return false; + } + Release release = getRelease(project); + Configuration configuration = project.getConfiguration(); +===================================================================== +Found a 16 line (35 tokens) duplication in the following files: +Starting at line 23 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/validation/ValidSurveyIdNameValidator.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/validation/ValidUniqueSurveyNumberValidator.java + + public void initialize(ValidSurveyIdName constraintAnnotation) { + } + + /* + * (non-Javadoc) + * + * @see javax.validation.ConstraintValidator#isValid(java.lang.Object, + * javax.validation.ConstraintValidatorContext) + */ + @Override + public boolean isValid(Survey survey, ConstraintValidatorContext context) { + if (survey.isShadow()) { + return true; + } else { + // check for set project id + if (survey.getId() == null || survey.getDataAcquisitionProjectId() == null +===================================================================== +Found a 14 line (35 tokens) duplication in the following files: +Starting at line 22 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/ValidDerivedVariablesIdentifierValidator.java +Starting at line 21 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/ValidRepeatedMeasurementIdentifierValidator.java +Starting at line 24 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/ValidVariableIdNameValidator.java + + public void initialize(ValidDerivedVariablesIdentifier constraintAnnotation) {} + + /* + * (non-Javadoc) + * + * @see javax.validation.ConstraintValidator#isValid(java.lang.Object, + * javax.validation.ConstraintValidatorContext) + */ + @Override + public boolean isValid(Variable variable, ConstraintValidatorContext context) { + if (variable.isShadow()) { + return true; + } else { + if (variable.getDerivedVariablesIdentifier() == null) { +===================================================================== +Found a 6 line (35 tokens) duplication in the following files: +Starting at line 29 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/config/locale/AngularCookieLocaleResolverTest.java +Starting at line 44 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/config/locale/AngularCookieLocaleResolverTest.java +Starting at line 74 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/config/locale/AngularCookieLocaleResolverTest.java + + public void testResolveLocale() { + // Arrange + AngularCookieLocaleResolver resolver = new AngularCookieLocaleResolver(); + HttpServletRequest servlet = Mockito.mock(HttpServletRequest.class); + when(servlet.getAttribute(CookieLocaleResolver.LOCALE_REQUEST_ATTRIBUTE_NAME)) + .thenReturn(Locale.GERMAN); +===================================================================== +Found a 7 line (35 tokens) duplication in the following files: +Starting at line 75 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/domain/I18nStringTest.java +Starting at line 84 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/domain/PeriodTest.java + + assertThat(checkSameButDifferentNoEnPart, is(false)); + assertThat(checkSameButDifferent, is(true)); + assertThat(checkSameButDifferentStart, is(false)); + assertThat(checkSameButDifferentEnd, is(false)); + } + +} +===================================================================== +Found a 5 line (35 tokens) duplication in the following files: +Starting at line 142 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 214 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java + + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().is2xxSuccessful()); + + // read the concept under the new url + mockMvc.perform(get(API_CONCEPT_URI + "/" + concept.getId())).andExpect(status().isOk()) + .andExpect(jsonPath("$.id", is(concept.getId()))).andExpect(jsonPath("$.version", is(1))) +===================================================================== +Found a 5 line (35 tokens) duplication in the following files: +Starting at line 206 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 302 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 326 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java + + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().is2xxSuccessful()); + + // read the dataPackage under the new url + mockMvc.perform(get(API_DATAPACKAGE_URI + "/" + dataPackage.getId())).andExpect(status().isOk()) + .andExpect(jsonPath("$.id", is(dataPackage.getId()))) +===================================================================== +Found a 6 line (35 tokens) duplication in the following files: +Starting at line 92 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java +Starting at line 92 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java +Starting at line 92 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java +Starting at line 93 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionImageShadowCopyServiceTest.java +Starting at line 88 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java + + mongoTemplate.getConverter().read(DataPackageAttachmentMetadata.class, gridFsFile.getMetadata()); + + assertThat(gridFsFile, notNullValue()); + assertThat(metaData, notNullValue()); + assertThat(metaData.getId(), + equalTo("/public/files/data-packages/stu-" + PROJECT_ID + "$-1.0.0/attachments/filename.txt")); +===================================================================== +Found a 11 line (35 tokens) duplication in the following files: +Starting at line 306 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 176 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 344 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + .andExpect(jsonPath("$.description.de", is("Angepasst."))); + + elasticsearchUpdateQueueService.processAllQueueItems(); + + // check that there is one data set documents + assertThat(elasticsearchAdminService.countAllDocuments(), equalTo(1L)); + } + + @Test + @WithMockUser(authorities=AuthoritiesConstants.PUBLISHER) + public void testCreateShadowCopyDataSet() throws Exception { +===================================================================== +Found a 7 line (35 tokens) duplication in the following files: +Starting at line 371 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 277 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 324 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 809 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + .andExpect(status().isCreated()); + + mockMvc.perform(delete("/api/data-acquisition-projects/" + project.getId())) + .andExpect(status().is2xxSuccessful()); + + // check that the DataSet has been deleted + mockMvc.perform(get(API_DATASETS_URI + "/" + dataSet.getId())) +===================================================================== +Found a 6 line (35 tokens) duplication in the following files: +Starting at line 77 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java +Starting at line 114 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java +Starting at line 145 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java + + public void createShadowCopy() throws Exception { + DataSetAttachmentMetadata master = + UnitTestCreateDomainObjectUtils.buildDataSetAttachmentMetadata(PROJECT_ID, 1); + master.generateId(); + master.setMasterId(master.getId()); + createTestFileForAttachment(master); +===================================================================== +Found a 6 line (35 tokens) duplication in the following files: +Starting at line 101 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 134 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 169 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java + + assertThat(elasticsearchAdminService.countAllDocuments(), equalTo(1L)); + + // check that auditing attributes have been set + mockMvc.perform(get(API_INSTRUMENTS_URI + "/" + instrument.getId())) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.createdDate", not(isEmptyOrNullString()))) +===================================================================== +Found a 6 line (35 tokens) duplication in the following files: +Starting at line 77 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java +Starting at line 114 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java +Starting at line 148 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java + + public void createShadowCopy() throws Exception { + InstrumentAttachmentMetadata master = + UnitTestCreateDomainObjectUtils.buildInstrumentAttachmentMetadata(PROJECT_ID, 1); + master.generateId(); + master.setMasterId(master.getId()); + createTestFileForAttachment(master); +===================================================================== +Found a 4 line (35 tokens) duplication in the following files: +Starting at line 49 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/logmanagement/rest/LogsResourceTest.java +Starting at line 119 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java +Starting at line 80 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/UserResourceTest.java + + this.restUserMockMvc.perform(get("/api/logs").accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) + .andReturn(); +===================================================================== +Found a 8 line (35 tokens) duplication in the following files: +Starting at line 121 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DaraServiceTest.java +Starting at line 791 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + .content(TestUtil.convertObjectToJsonBytes(project)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER) + public void testReleaseShadowThrowsError() throws Exception { +===================================================================== +Found a 17 line (35 tokens) duplication in the following files: +Starting at line 26 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectLastReleaseResourceTest.java +Starting at line 26 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectReleasesResourceTest.java +Starting at line 36 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + +public class DataAcquisitionProjectLastReleaseResourceTest extends AbstractTest { + private static final String API_DATA_ACQUISITION_PROJECTS_URI = "/api/data-acquisition-projects"; + + @Autowired + private WebApplicationContext wac; + + @Autowired + private DataAcquisitionProjectRepository dataAcquisitionProjectRepository; + + @Autowired + private ElasticsearchUpdateQueueItemRepository elasticsearchUpdateQueueItemRepository; + + @Autowired + private ElasticsearchAdminService elasticsearchAdminService; + + @Autowired + private JaversService javersService; +===================================================================== +Found a 7 line (35 tokens) duplication in the following files: +Starting at line 114 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 343 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 433 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java + + buildValidProject(); + + // Act & Assert + mockMvc.perform(post(API_DATA_ACQUISITION_PROJECTS_POST_VALIDATION_URI)) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.errors", hasSize(0)));//no errors + } +===================================================================== +Found a 6 line (35 tokens) duplication in the following files: +Starting at line 105 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 136 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 192 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java + + assertThat(elasticsearchAdminService.countAllDocuments(), equalTo(1L)); + + // check that auditing attributes have been set + mockMvc.perform(get(API_QUESTIONS_URI + "/" + question.getId())) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.createdDate", not(isEmptyOrNullString()))) +===================================================================== +Found a 6 line (35 tokens) duplication in the following files: +Starting at line 78 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionImageShadowCopyServiceTest.java +Starting at line 115 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionImageShadowCopyServiceTest.java +Starting at line 146 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionImageShadowCopyServiceTest.java + + public void createShadowCopy() throws Exception { + QuestionImageMetadata master = + UnitTestCreateDomainObjectUtils.buildQuestionImageMetadata(PROJECT_ID, QUESTION_ID); + master.generateId(); + master.setMasterId(master.getId()); + createTestFileForAttachment(master); +===================================================================== +Found a 6 line (35 tokens) duplication in the following files: +Starting at line 73 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java +Starting at line 111 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java +Starting at line 142 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java + + public void createShadowCopy() throws Exception { + SurveyAttachmentMetadata master = + UnitTestCreateDomainObjectUtils.buildSurveyAttachmentMetadata(PROJECT_ID, 1); + master.generateId(); + master.setMasterId(master.getId()); + createTestFileForAttachment(master); +===================================================================== +Found a 5 line (35 tokens) duplication in the following files: +Starting at line 174 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java +Starting at line 189 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java + + public void testSaveAccount() throws Exception { + // Arrange + Optional userO = this.userRepository.findOneByLogin("admin"); + User user = userO.get(); + UserDto dto = new UserDto(user); +===================================================================== +Found a 6 line (35 tokens) duplication in the following files: +Starting at line 73 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/service/UserServiceTest.java +Starting at line 94 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/service/UserServiceTest.java + + public void assertThatResetKeyMustNotBeOlderThan24Hours() { + User user = userService.createUserInformation("johndoe", "johndoe", "John", "Doe", + "john.doe@localhost", "en-US"); + + LocalDateTime daysAgo = LocalDateTime.now() + .minusHours(25); +===================================================================== +Found a 5 line (35 tokens) duplication in the following files: +Starting at line 121 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 152 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 662 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + assertThat(elasticsearchAdminService.countAllDocuments(), equalTo(1L)); + + // check that auditing attributes have been set + mockMvc.perform(get(API_VARIABLES_URI + "/" + variable.getId())).andExpect(status().isOk()) + .andExpect(jsonPath("$.createdDate", not(isEmptyOrNullString()))) +===================================================================== +Found a 9 line (35 tokens) duplication in the following files: +Starting at line 35 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/common/domain/QTask.java +Starting at line 40 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/domain/QConcept.java +Starting at line 46 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java +Starting at line 30 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/domain/QDaraUpdateQueueItem.java +Starting at line 41 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSubDocument.java +Starting at line 41 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySubDocument.java +Starting at line 48 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QSurvey.java + + public final StringPath id = createString("id"); + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + public final StringPath location = createString("location"); +===================================================================== +Found a 11 line (35 tokens) duplication in the following files: +Starting at line 38 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/domain/QConcept.java +Starting at line 32 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/domain/QShadowCopyQueueItem.java +Starting at line 35 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSubDocument.java +Starting at line 34 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/domain/QElasticsearchUpdateQueueItem.java + + public final StringPath doi = createString("doi"); + + public final StringPath id = createString("id"); + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + public final StringPath license = createString("license"); +===================================================================== +Found a 4 line (35 tokens) duplication in the following files: +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QDataSet.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java +Starting at line 22 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QSurvey.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractShadowableRdcDomainObject _super = new eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractShadowableRdcDomainObject(this); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("annotations")); +===================================================================== +Found a 11 line (35 tokens) duplication in the following files: +Starting at line 26 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java +Starting at line 24 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/domain/QShadowCopyQueueItem.java +Starting at line 31 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/domain/QQuestion.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSubDocument.java +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSubDocument.java +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSubDocument.java +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSubDocument.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySubDocument.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSubDocument.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("annotations")); + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + public final StringPath dataAcquisitionProjectId = createString("dataAcquisitionProjectId"); + + public final ListPath dataCurators = this.createList("dataCurators", eu.dzhw.fdz.metadatamanagement.common.domain.Person.class, eu.dzhw.fdz.metadatamanagement.common.domain.QPerson.class, PathInits.DIRECT2); +===================================================================== +Found a 9 line (35 tokens) duplication in the following files: +Starting at line 46 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 50 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QDataSet.java +Starting at line 72 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 39 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSubDocument.java +Starting at line 45 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSubDocument.java +Starting at line 72 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java + + public final ListPath institutions = this.createList("institutions", eu.dzhw.fdz.metadatamanagement.common.domain.I18nString.class, eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString.class, PathInits.DIRECT2); + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + public final StringPath masterId = createString("masterId"); +===================================================================== +Found a 11 line (35 tokens) duplication in the following files: +Starting at line 46 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 50 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QDataSet.java +Starting at line 46 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java +Starting at line 42 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/domain/QDataAcquisitionProject.java +Starting at line 58 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/domain/QQuestion.java +Starting at line 39 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSubDocument.java +Starting at line 45 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSubDocument.java +Starting at line 41 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSubDocument.java +Starting at line 43 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSubDocument.java +Starting at line 41 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySubDocument.java +Starting at line 48 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QSurvey.java +Starting at line 68 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/QVariable.java + + public final ListPath institutions = this.createList("institutions", eu.dzhw.fdz.metadatamanagement.common.domain.I18nString.class, eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString.class, PathInits.DIRECT2); + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + public final StringPath masterId = createString("masterId"); + + public final ListPath projectContributors = this.createList("projectContributors", eu.dzhw.fdz.metadatamanagement.common.domain.Person.class, eu.dzhw.fdz.metadatamanagement.common.domain.QPerson.class, PathInits.DIRECT2); +===================================================================== +Found a 3 line (35 tokens) duplication in the following files: +Starting at line 54 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 101 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 47 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSubDocument.java + + public final StringPath masterId = createString("masterId"); + + public final ListPath projectContributors = this.createList("projectContributors", eu.dzhw.fdz.metadatamanagement.common.domain.Person.class, eu.dzhw.fdz.metadatamanagement.common.domain.QPerson.class, PathInits.DIRECT2); +===================================================================== +Found a 3 line (35 tokens) duplication in the following files: +Starting at line 70 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QDataSet.java +Starting at line 69 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java +Starting at line 53 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetNestedDocument.java +Starting at line 65 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSubDocument.java +Starting at line 53 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentNestedDocument.java +Starting at line 59 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSubDocument.java +Starting at line 55 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableNestedDocument.java +Starting at line 61 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSubDocument.java +Starting at line 97 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/QVariable.java + + public final ListPath surveyIds = this.createList("surveyIds", String.class, StringPath.class, PathInits.DIRECT2); + + public final ListPath> surveyNumbers = this.>createList("surveyNumbers", Integer.class, NumberPath.class, PathInits.DIRECT2); +===================================================================== +Found a 4 line (35 tokens) duplication in the following files: +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/domain/QQuestion.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractShadowableRdcDomainObject _super = new eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractShadowableRdcDomainObject(this); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString additionalQuestionText = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("additionalQuestionText")); +===================================================================== +Found a 8 line (35 tokens) duplication in the following files: +Starting at line 61 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/domain/QQuestion.java +Starting at line 46 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSubDocument.java +Starting at line 46 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSubDocument.java + + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + public final StringPath masterId = createString("masterId"); + + public final StringPath number = createString("number"); +===================================================================== +Found a 8 line (35 tokens) duplication in the following files: +Starting at line 64 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/domain/QQuestion.java +Starting at line 45 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionNestedDocument.java + + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + public final StringPath masterId = createString("masterId"); + + public final StringPath number = createString("number"); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString questionText = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("questionText")); +===================================================================== +Found a 11 line (35 tokens) duplication in the following files: +Starting at line 28 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/domain/QRelatedPublication.java +Starting at line 22 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationSubDocument.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("annotations")); + + public final StringPath authors = createString("authors"); + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + public final ListPath dataPackageIds = this.createList("dataPackageIds", String.class, StringPath.class, PathInits.DIRECT2); +===================================================================== +Found a 9 line (35 tokens) duplication in the following files: +Starting at line 39 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QAbstractNestedSubDocument.java +Starting at line 33 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/domain/QElasticsearchIndicesVersion.java + + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + //inherited + public final NumberPath version = _super.version; + + public QAbstractNestedSubDocument(String variable) { +===================================================================== +Found a 2 line (35 tokens) duplication in the following files: +Starting at line 67 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptNestedDocument.java +Starting at line 122 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 73 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageNestedDocument.java +Starting at line 77 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetNestedDocument.java +Starting at line 149 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java +Starting at line 77 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentNestedDocument.java +Starting at line 79 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionNestedDocument.java +Starting at line 69 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationNestedDocument.java +Starting at line 111 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationSearchDocument.java +Starting at line 77 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveyNestedDocument.java +Starting at line 79 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableNestedDocument.java + + this.completeTitle = inits.isInitialized("completeTitle") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("completeTitle")) : null; + this.createdBy = _super.createdBy; +===================================================================== +Found a 3 line (35 tokens) duplication in the following files: +Starting at line 41 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 48 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationSearchDocument.java + + public final ListPath dataPackages = this.createList("dataPackages", DataPackageSubDocument.class, QDataPackageSubDocument.class, PathInits.DIRECT2); + + public final ListPath dataSets = this.createList("dataSets", DataSetSubDocument.class, QDataSetSubDocument.class, PathInits.DIRECT2); +===================================================================== +Found a 11 line (35 tokens) duplication in the following files: +Starting at line 47 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 48 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationSearchDocument.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString description = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(_super.description); + + //inherited + public final StringPath doi = _super.doi; + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString guiLabels; + + //inherited + public final StringPath id = _super.id; + + public final ListPath instruments = this.createList("instruments", InstrumentSubDocument.class, QInstrumentSubDocument.class, PathInits.DIRECT2); +===================================================================== +Found a 4 line (35 tokens) duplication in the following files: +Starting at line 57 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 72 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java +Starting at line 95 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + public final ListPath instruments = this.createList("instruments", InstrumentSubDocument.class, QInstrumentSubDocument.class, PathInits.DIRECT2); + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; +===================================================================== +Found a 3 line (35 tokens) duplication in the following files: +Starting at line 70 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 85 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 100 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java + + public final ListPath nestedDataSets = this.createList("nestedDataSets", DataSetNestedDocument.class, QDataSetNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedInstruments = this.createList("nestedInstruments", InstrumentNestedDocument.class, QInstrumentNestedDocument.class, PathInits.DIRECT2); +===================================================================== +Found a 3 line (35 tokens) duplication in the following files: +Starting at line 83 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 106 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 99 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java +Starting at line 95 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 102 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java + + public final ListPath questions = this.createList("questions", QuestionSubDocument.class, QQuestionSubDocument.class, PathInits.DIRECT2); + + public final StringPath release = createString("release"); +===================================================================== +Found a 5 line (35 tokens) duplication in the following files: +Starting at line 89 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 133 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 129 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 155 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + public final ListPath surveys = this.createList("surveys", SurveySubDocument.class, QSurveySubDocument.class, PathInits.DIRECT2); + + // custom + // inherited + public final eu.dzhw.fdz.metadatamanagement.conceptmanagement.domain.QTags tags = new eu.dzhw.fdz.metadatamanagement.conceptmanagement.domain.QTags(_super.tags); +===================================================================== +Found a 12 line (35 tokens) duplication in the following files: +Starting at line 59 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 58 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 58 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 82 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + public final StringPath doi = createString("doi"); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString guiLabels; + + //inherited + public final BooleanPath hidden = _super.hidden; + + //inherited + public final StringPath id = _super.id; + + //inherited + public final ListPath institutions = _super.institutions; +===================================================================== +Found a 4 line (35 tokens) duplication in the following files: +Starting at line 72 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 68 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java + + public final ListPath instruments = this.createList("instruments", InstrumentSubDocument.class, QInstrumentSubDocument.class, PathInits.DIRECT2); + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; +===================================================================== +Found a 3 line (35 tokens) duplication in the following files: +Starting at line 83 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 84 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java +Starting at line 113 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + public final ListPath nestedConcepts = this.createList("nestedConcepts", ConceptNestedDocument.class, QConceptNestedDocument.class, PathInits.DIRECT2); + + public final ListPath nestedDataSets = this.createList("nestedDataSets", DataSetNestedDocument.class, QDataSetNestedDocument.class, PathInits.DIRECT2); +===================================================================== +Found a 2 line (35 tokens) duplication in the following files: +Starting at line 168 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 158 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java +Starting at line 150 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 169 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 159 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java +Starting at line 182 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + this.guiLabels = inits.isInitialized("guiLabels") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("guiLabels")) : null; + this.release = inits.isInitialized("release") ? new eu.dzhw.fdz.metadatamanagement.projectmanagement.domain.QRelease(forProperty("release")) : null; +===================================================================== +Found a 2 line (35 tokens) duplication in the following files: +Starting at line 169 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 167 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java + + this.release = inits.isInitialized("release") ? new eu.dzhw.fdz.metadatamanagement.projectmanagement.domain.QRelease(forProperty("release")) : null; + this.surveyPeriod = inits.isInitialized("surveyPeriod") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QPeriod(forProperty("surveyPeriod")) : null; +===================================================================== +Found a 2 line (35 tokens) duplication in the following files: +Starting at line 80 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetNestedDocument.java +Starting at line 90 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSubDocument.java +Starting at line 80 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentNestedDocument.java +Starting at line 86 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSubDocument.java + + this.description = inits.isInitialized("description") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("description")) : null; + this.lastModifiedBy = _super.lastModifiedBy; +===================================================================== +Found a 5 line (35 tokens) duplication in the following files: +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSubDocument.java + + public final ListPath accessWays = this.createList("accessWays", String.class, StringPath.class, PathInits.DIRECT2); + + // custom + // inherited + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations; +===================================================================== +Found a 2 line (35 tokens) duplication in the following files: +Starting at line 84 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionNestedDocument.java +Starting at line 84 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSubDocument.java + + this.questionText = inits.isInitialized("questionText") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("questionText")) : null; + this.version = _super.version; +===================================================================== +Found a 4 line (34 tokens) duplication in the following files: +Starting at line 42 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/rest/I18nResourceController.java +Starting at line 26 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataFormatsResource.java +Starting at line 34 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveySampleTypeResource.java +Starting at line 33 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/UnitValueResource.java + + public ResponseEntity> getCountryCodes() { + return ResponseEntity.ok() + .cacheControl(CacheControl.maxAge(0, TimeUnit.DAYS).mustRevalidate().cachePublic()) + .eTag(ETAG.toString()) +===================================================================== +Found a 10 line (34 tokens) duplication in the following files: +Starting at line 39 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/domain/Concept.java +Starting at line 49 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/DataPackage.java +Starting at line 26 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/ordermanagement/domain/Order.java + +@Document(collection = "concepts") +@EqualsAndHashCode(callSuper = false, of = "id") +@ToString(callSuper = true) +@NoArgsConstructor +@Data +@AllArgsConstructor +@Builder +@Schema( + description = "Go here" +===================================================================== +Found a 5 line (34 tokens) duplication in the following files: +Starting at line 19 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/domain/validation/ConceptExists.java +Starting at line 19 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/domain/validation/DataPackageExists.java +Starting at line 19 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/domain/validation/VariableExists.java + +@Constraint(validatedBy = {ConceptExistsValidator.class}) +@Repeatable(List.class) +@Target({ElementType.TYPE, ElementType.TYPE_USE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface ConceptExists { +===================================================================== +Found a 9 line (34 tokens) duplication in the following files: +Starting at line 82 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/helper/DataPackageShadowCopyDataSource.java +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/helper/DataSetShadowCopyDataSource.java +Starting at line 91 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/helper/InstrumentShadowCopyDataSource.java +Starting at line 92 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/helper/QuestionShadowCopyDataSource.java +Starting at line 82 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/helper/SurveyShadowCopyDataSource.java +Starting at line 123 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/helper/VariableShadowCopyDataSource.java + + dataPackages.forEach(crudHelper::deleteShadow); + } + } + + @Override + public void updateElasticsearch(String dataAcquisitionProjectId, String releaseVersion, + String previousVersion) { + elasticsearchUpdateQueueService.enqueueUpsertsAsync(() -> { + return dataPackageRepository +===================================================================== +Found a 5 line (34 tokens) duplication in the following files: +Starting at line 99 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java +Starting at line 115 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java +Starting at line 299 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java +Starting at line 378 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java + + log.debug("Sending activation e-mail to '{}'", user.getEmail()); + Locale locale = Locale.forLanguageTag(user.getLangKey()); + Context context = new Context(locale); + context.setVariable("user", user); + context.setVariable("baseUrl", baseUrl); +===================================================================== +Found a 5 line (34 tokens) duplication in the following files: +Starting at line 236 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java +Starting at line 264 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java + + public void sendAssigneeGroupChangedMail(List users, String projectId, String message, + String sender, User currentUser) { + + if (!users.isEmpty()) { + log.debug("Sending 'assignee group changed mail'"); +===================================================================== +Found a 5 line (34 tokens) duplication in the following files: +Starting at line 83 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectAttachmentsResourceController.java +Starting at line 90 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectAttachmentsResourceController.java + + ArrayList::new)); + } + + private List sort(List attachments, Function firstOrderCriteria, + Function secondOrderCriteria) { +===================================================================== +Found a 6 line (34 tokens) duplication in the following files: +Starting at line 62 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/DataPackageSearchDocument.java +Starting at line 47 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/DataSetSearchDocument.java +Starting at line 48 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/SurveySearchDocument.java + + private List nestedInstruments = new ArrayList<>(); + + private List concepts = new ArrayList<>(); + private List nestedConcepts = new ArrayList<>(); + + private List nestedInstitutions = new ArrayList<>(); +===================================================================== +Found a 4 line (34 tokens) duplication in the following files: +Starting at line 50 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/repository/ElasticsearchUpdateQueueItemRepositoryImpl.java +Starting at line 72 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/repository/ElasticsearchUpdateQueueItemRepositoryImpl.java + + .is(updateStartedAt))).limit(BULK_SIZE) + .with(Sort.by(Direction.ASC, "createdDate")); + return mongoOperations.find(query, ElasticsearchUpdateQueueItem.class); + } +===================================================================== +Found a 3 line (34 tokens) duplication in the following files: +Starting at line 29 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/usermanagement/repository/OAuth2AccessTokenRepositoryImpl.java +Starting at line 27 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/usermanagement/repository/OAuth2RefreshTokenRepositoryImpl.java + + public OAuth2AuthenticationAccessToken findByTokenId(final String tokenId) { + final Query query = Query.query(Criteria.where(ID).is(tokenId)); + return mongoTemplate.findOne(query, OAuth2AuthenticationAccessToken.class); +===================================================================== +Found a 4 line (34 tokens) duplication in the following files: +Starting at line 176 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/unittesthelper/util/UnitTestCreateDomainObjectUtils.java +Starting at line 183 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/unittesthelper/util/UnitTestCreateDomainObjectUtils.java +Starting at line 190 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/unittesthelper/util/UnitTestCreateDomainObjectUtils.java + + .description(I18nString.builder().de("Description DE") + .en("Description 3 EN") + .build()).build()); + subDataSets.add(SubDataSet.builder().name(UnitTestCreateValidIds.buildDataSetId(projectId, 2)) +===================================================================== +Found a 4 line (34 tokens) duplication in the following files: +Starting at line 405 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/unittesthelper/util/UnitTestCreateDomainObjectUtils.java +Starting at line 364 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java + + List surveyNumbers = new ArrayList<>(); + surveyNumbers.add(1); + List surveyIds = new ArrayList<>(); + surveyIds.add(surveyId); +===================================================================== +Found a 10 line (34 tokens) duplication in the following files: +Starting at line 60 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 45 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentVersionsResourceTest.java +Starting at line 67 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 52 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java +Starting at line 59 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAccessWaysResourceControllerTest.java +Starting at line 71 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 45 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentVersionsResourceTest.java +Starting at line 57 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 49 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/StudySeriesesResourceControllerTest.java +Starting at line 71 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 45 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentVersionsResourceTest.java +Starting at line 74 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 58 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java +Starting at line 56 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 45 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentVersionsResourceTest.java +Starting at line 57 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 67 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DaraServiceTest.java +Starting at line 44 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectLastReleaseResourceTest.java +Starting at line 44 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectReleasesResourceTest.java +Starting at line 60 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 62 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionImageResourceTest.java +Starting at line 71 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 50 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/rest/SearchResourceTest.java +Starting at line 70 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 45 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentVersionsResourceTest.java +Starting at line 68 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 69 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResponseRateImageResourceTest.java +Starting at line 57 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java +Starting at line 85 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + private MockMvc mockMvc; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac) + .build(); + } + + @After + public void cleanUp() { +===================================================================== +Found a 7 line (34 tokens) duplication in the following files: +Starting at line 93 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 120 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 131 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 152 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 163 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 184 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 200 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java + + conceptAttachmentMetadata.generateId(); + + // read the created attachment and check the version + mockMvc.perform( + get("/api/concepts/" + conceptAttachmentMetadata.getConceptId() + "/attachments")) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.[0].conceptId", is(conceptAttachmentMetadata.getConceptId()))) +===================================================================== +Found a 4 line (34 tokens) duplication in the following files: +Starting at line 100 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 205 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 110 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 221 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 111 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 219 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 93 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 169 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 107 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 199 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + .andExpect(jsonPath("$.[0].version", is(0))) + .andExpect(jsonPath("$.[0].createdBy", is("test"))) + .andExpect(jsonPath("$.[0].lastModifiedBy", is("test"))) + .andExpect(jsonPath("$.[0].id", is("/public/files/concepts/" +===================================================================== +Found a 6 line (34 tokens) duplication in the following files: +Starting at line 131 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 163 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 278 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java + + .andExpect(status().is2xxSuccessful()); + + // ensure the uploaded file does not exist anymore + mockMvc + .perform(get("/api/concepts/" + conceptAttachmentMetadata.getConceptId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(0))); +===================================================================== +Found a 7 line (34 tokens) duplication in the following files: +Starting at line 213 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 233 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java + + public void testUploadAttachmentWithWrongType() throws Exception { + + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); + ConceptAttachmentMetadata conceptAttachmentMetadata = UnitTestCreateDomainObjectUtils + .buildConceptAttachmentMetadata("con-conceptid$"); + conceptAttachmentMetadata.setType(new I18nString("hurz","hurz")); +===================================================================== +Found a 5 line (34 tokens) duplication in the following files: +Starting at line 104 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 157 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java + + mockMvc.perform(post(API_CONCEPT_URI).content(TestUtil.convertObjectToJsonBytes(concept)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); + + // read the concept under the new url + mockMvc.perform(get(API_CONCEPT_URI + "/" + concept.getId())).andExpect(status().isOk()); +===================================================================== +Found a 5 line (34 tokens) duplication in the following files: +Starting at line 79 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAccessWaysResourceControllerTest.java +Starting at line 114 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 136 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 166 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 111 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 130 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 186 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 217 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 239 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 75 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 99 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 67 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/StudySeriesesResourceControllerTest.java +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 115 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 141 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 161 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 180 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 200 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 235 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 264 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java + + public void testGetAccessWaysOfDataPackage() throws IOException, Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + DataPackage dataPackage = UnitTestCreateDomainObjectUtils.buildDataPackage(project.getId()); +===================================================================== +Found a 9 line (34 tokens) duplication in the following files: +Starting at line 101 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 142 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 175 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java + + dataPackageAttachmentMetadata.generateId(); + + // read the created attachment and check the version + mockMvc + .perform(get("/api/data-packages/" + + dataPackageAttachmentMetadata.getDataPackageId() + "/attachments")) + .andExpect(status().isOk()) + .andExpect( + jsonPath("$.[0].dataPackageId", is(dataPackageAttachmentMetadata.getDataPackageId()))) +===================================================================== +Found a 7 line (34 tokens) duplication in the following files: +Starting at line 130 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 163 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 196 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 212 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java + + dataPackageAttachmentMetadata.generateId(); + + // ensure that there is one attachment + mockMvc + .perform(get("/api/data-packages/" + dataPackageAttachmentMetadata.getDataPackageId() + + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(1))); +===================================================================== +Found a 6 line (34 tokens) duplication in the following files: +Starting at line 142 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 175 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 212 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 291 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java + + .andExpect(status().is2xxSuccessful()); + + // ensure the uploaded file does not exist anymore + mockMvc.perform(get( + "/api/data-packages/" + dataPackageAttachmentMetadata.getDataPackageId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(0))); +===================================================================== +Found a 7 line (34 tokens) duplication in the following files: +Starting at line 231 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 250 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 301 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java + + public void testUploadAttachmentWithWrongType() throws Exception { + + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); + DataPackageAttachmentMetadata dataPackageAttachmentMetadata = + UnitTestCreateDomainObjectUtils.buildDataPackageAttachmentMetadata("projectid"); + dataPackageAttachmentMetadata.setType(new I18nString("hurz", "hurz")); +===================================================================== +Found a 3 line (34 tokens) duplication in the following files: +Starting at line 149 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 180 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 206 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 124 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 140 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 157 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 176 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 183 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 204 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 211 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 337 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 349 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 361 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 369 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 191 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResourceTest.java +Starting at line 81 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 103 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 147 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + + mockMvc.perform(put("/api/data-acquisition-projects" + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isNoContent()); +===================================================================== +Found a 6 line (34 tokens) duplication in the following files: +Starting at line 119 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 224 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java + + .perform(post(API_DATAPACKAGE_URI).content(TestUtil.convertObjectToJsonBytes(dataPackage)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); + + // read the dataPackage under the new url + mockMvc.perform(get(API_DATAPACKAGE_URI + "/" + dataPackage.getId())) +===================================================================== +Found a 5 line (34 tokens) duplication in the following files: +Starting at line 101 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java +Starting at line 168 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java + + equalTo("/data-packages/stu-" + PROJECT_ID + "$-1.0.0/attachments/filename.txt")); + + List expectedFiles = new ArrayList<>(); + expectedFiles.add("/data-packages/stu-" + PROJECT_ID + "$/attachments/filename.txt"); + expectedFiles.add("/data-packages/stu-" + PROJECT_ID + "$-1.0.0/attachments/filename.txt"); +===================================================================== +Found a 6 line (34 tokens) duplication in the following files: +Starting at line 109 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java +Starting at line 109 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java +Starting at line 109 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java +Starting at line 106 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java + + .getResource("/data-packages/stu-" + PROJECT_ID + "$-1.0.0/attachments/filename.txt"); + assertThat(shadowCopy.getOptions().getMetadata().get("_contentType"), equalTo("text/plain")); + } + + @Test + public void createShadowCopyWithSameReleaseVersion() throws Exception { +===================================================================== +Found a 6 line (34 tokens) duplication in the following files: +Starting at line 177 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java +Starting at line 177 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java +Starting at line 180 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java +Starting at line 174 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java + + .getResource("/data-packages/stu-" + PROJECT_ID + "$-1.0.0/attachments/filename.txt"); + assertThat(predecessor.getOptions().getMetadata().get("_contentType"), equalTo("text/plain")); + } + + @Test + public void createShadowCopyWithDeletedMaster() throws Exception { +===================================================================== +Found a 3 line (34 tokens) duplication in the following files: +Starting at line 107 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageShadowCopyServiceTest.java +Starting at line 159 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetShadowCopyServiceTest.java +Starting at line 151 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentShadowCopyServiceTest.java +Starting at line 142 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/service/DataAcquisitionProjectShadowCopyServiceTest.java +Starting at line 160 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionShadowCopyServiceTest.java +Starting at line 155 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyShadowCopyServiceTest.java +Starting at line 152 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/VariableShadowCopyServiceTest.java + + Optional persistedShadow = dataPackageRepository.findById(shadow.getId()); + assertThat(persistedShadow.isPresent(), equalTo(true)); + assertThat(persistedShadow.get().getSuccessorId(), nullValue()); +===================================================================== +Found a 4 line (34 tokens) duplication in the following files: +Starting at line 151 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageShadowCopyServiceTest.java +Starting at line 113 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetShadowCopyServiceTest.java +Starting at line 107 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentShadowCopyServiceTest.java +Starting at line 98 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/service/DataAcquisitionProjectShadowCopyServiceTest.java +Starting at line 114 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionShadowCopyServiceTest.java +Starting at line 111 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyShadowCopyServiceTest.java +Starting at line 108 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/VariableShadowCopyServiceTest.java + + Optional persistedShadow = dataPackageRepository.findById(shadow.getId()); + + assertThat(persistedShadow.isPresent(), equalTo(true)); + assertThat(persistedShadow.get().getSuccessorId(), equalTo("DELETED")); +===================================================================== +Found a 6 line (34 tokens) duplication in the following files: +Starting at line 90 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 119 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 152 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 185 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 227 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 247 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 59 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentVersionsResourceTest.java + + public void testUploadValidAttachment() throws Exception { + + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); + DataSetAttachmentMetadata dataSetAttachmentMetadata = UnitTestCreateDomainObjectUtils + .buildDataSetAttachmentMetadata("projectid", 1); +===================================================================== +Found a 7 line (34 tokens) duplication in the following files: +Starting at line 104 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 131 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 142 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 164 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 175 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 196 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 212 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java + + dataSetAttachmentMetadata.generateId(); + + // read the created attachment and check the version + mockMvc.perform( + get("/api/data-sets/" + dataSetAttachmentMetadata.getDataSetId() + "/attachments")) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.[0].dataSetId", is(dataSetAttachmentMetadata.getDataSetId()))) +===================================================================== +Found a 6 line (34 tokens) duplication in the following files: +Starting at line 142 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 175 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 293 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java + + .andExpect(status().is2xxSuccessful()); + + // ensure the uploaded file does not exist anymore + mockMvc + .perform(get("/api/data-sets/" + dataSetAttachmentMetadata.getDataSetId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(0))); +===================================================================== +Found a 7 line (34 tokens) duplication in the following files: +Starting at line 93 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 127 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 157 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 176 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 194 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 277 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 357 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java + + public void testCreateDataSet() throws Exception { + + // Arrange + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + this.dataAcquisitionProjectRepository.save(project); + + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); +===================================================================== +Found a 3 line (34 tokens) duplication in the following files: +Starting at line 105 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 258 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 288 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 369 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 120 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java +Starting at line 129 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java + + mockMvc.perform(put(API_DATASETS_URI + "/" + dataSet.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataSet)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 6 line (34 tokens) duplication in the following files: +Starting at line 136 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 318 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java + + UnitTestCreateDomainObjectUtils.buildDataSet(project.getId(), survey.getId(), 1); + + // Act and Assert + // create the variable with the given id + mockMvc.perform(post(API_DATASETS_URI).content(TestUtil.convertObjectToJsonBytes(dataSet)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); +===================================================================== +Found a 5 line (34 tokens) duplication in the following files: +Starting at line 140 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 258 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 369 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java + + mockMvc.perform(post(API_DATASETS_URI).content(TestUtil.convertObjectToJsonBytes(dataSet)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); + + // check that auditing attributes have been set + mockMvc.perform(get(API_DATASETS_URI + "/" + dataSet.getId())).andExpect(status().isOk()) +===================================================================== +Found a 3 line (34 tokens) duplication in the following files: +Starting at line 170 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 188 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 204 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 219 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 242 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 297 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 335 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 86 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java +Starting at line 111 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java + + mockMvc.perform(put(API_DATASETS_URI + "/" + dataSet.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataSet)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()); +===================================================================== +Found a 7 line (34 tokens) duplication in the following files: +Starting at line 371 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 277 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 324 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 365 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 809 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + .andExpect(status().isCreated()); + + mockMvc.perform(delete("/api/data-acquisition-projects/" + project.getId())) + .andExpect(status().is2xxSuccessful()); + + // check that the DataSet has been deleted + mockMvc.perform(get(API_DATASETS_URI + "/" + dataSet.getId())) +===================================================================== +Found a 5 line (34 tokens) duplication in the following files: +Starting at line 76 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java +Starting at line 100 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java +Starting at line 75 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java +Starting at line 95 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java + + public void testCreateDataSetAndReadVersions() throws IOException, Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); +===================================================================== +Found a 5 line (34 tokens) duplication in the following files: +Starting at line 101 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java +Starting at line 168 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java + + equalTo("/data-sets/dat-" + PROJECT_ID + "-ds1$-1.0.0/attachments/filename.txt")); + + List expectedFiles = new ArrayList<>(); + expectedFiles.add("/data-sets/dat-" + PROJECT_ID + "-ds1$/attachments/filename.txt"); + expectedFiles.add("/data-sets/dat-" + PROJECT_ID + "-ds1$-1.0.0/attachments/filename.txt"); +===================================================================== +Found a 8 line (34 tokens) duplication in the following files: +Starting at line 67 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 76 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java + + this.elasticsearchUpdateQueueItemRepository.deleteAll(); + this.elasticsearchAdminService.recreateAllIndices(); + this.javersService.deleteAll(); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER, username = "test") + public void testUploadValidAttachment() throws Exception { +===================================================================== +Found a 6 line (34 tokens) duplication in the following files: +Starting at line 74 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 101 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 133 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 177 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 209 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 228 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 59 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentVersionsResourceTest.java + + public void testUploadValidAttachment() throws Exception { + + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); + InstrumentAttachmentMetadata instrumentAttachmentMetadata = + UnitTestCreateDomainObjectUtils.buildInstrumentAttachmentMetadata("projectid", 1); +===================================================================== +Found a 8 line (34 tokens) duplication in the following files: +Starting at line 84 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 110 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 122 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 142 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 186 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 198 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 271 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java + + .file(attachment).file(metadata)).andExpect(status().isCreated()); + + // read the created attachment and check the version + mockMvc + .perform(get( + "/api/instruments/" + instrumentAttachmentMetadata.getInstrumentId() + "/attachments")) + .andExpect(status().isOk()) + .andExpect( +===================================================================== +Found a 3 line (34 tokens) duplication in the following files: +Starting at line 94 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 156 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 196 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 271 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 115 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 124 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java + + mockMvc.perform(put(API_INSTRUMENTS_URI + "/" + instrument.getId()) + .content(TestUtil.convertObjectToJsonBytes(instrument)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 6 line (34 tokens) duplication in the following files: +Starting at line 124 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 293 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java + + UnitTestCreateDomainObjectUtils.buildInstrument(project.getId(), project.getId() + "-sy1"); + + // Act and Assert + // create the instrument with the given id + mockMvc.perform(post(API_INSTRUMENTS_URI).content(TestUtil.convertObjectToJsonBytes(instrument)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); +===================================================================== +Found a 3 line (34 tokens) duplication in the following files: +Starting at line 167 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 208 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 231 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 253 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 309 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 83 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 106 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java + + mockMvc.perform(put(API_INSTRUMENTS_URI + "/" + instrument.getId()) + .content(TestUtil.convertObjectToJsonBytes(instrument)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().is2xxSuccessful()); +===================================================================== +Found a 5 line (34 tokens) duplication in the following files: +Starting at line 75 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 97 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java + + public void testCreateInstrumentAndReadVersions() throws IOException, Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + dataAcquisitionProjectRepository.save(project); + + Instrument instrument = UnitTestCreateDomainObjectUtils.buildInstrument(project.getId()); +===================================================================== +Found a 5 line (34 tokens) duplication in the following files: +Starting at line 101 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java +Starting at line 171 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java + + equalTo("/instruments/ins-" + PROJECT_ID + "-ins1$-1.0.0/attachments/filename.txt")); + + List expectedFiles = new ArrayList<>(); + expectedFiles.add("/instruments/ins-" + PROJECT_ID + "-ins1$/attachments/filename.txt"); + expectedFiles.add("/instruments/ins-" + PROJECT_ID + "-ins1$-1.0.0/attachments/filename.txt"); +===================================================================== +Found a 3 line (34 tokens) duplication in the following files: +Starting at line 63 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/ordermanagement/rest/OrderResourceTest.java +Starting at line 107 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/ordermanagement/rest/OrderResourceTest.java + + Order order = createOrder(); + mockMvc.perform(post("/api/orders").contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(order))).andExpect(status().isCreated()); +===================================================================== +Found a 4 line (34 tokens) duplication in the following files: +Starting at line 104 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 236 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java + + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + // create the project with the given id + mockMvc.perform(post(API_DATA_ACQUISITION_PROJECTS_URI).contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isCreated()); +===================================================================== +Found a 5 line (34 tokens) duplication in the following files: +Starting at line 106 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 140 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java + + mockMvc.perform(post(API_DATA_ACQUISITION_PROJECTS_URI).contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isCreated()); + + // read the project under the new url + mockMvc.perform(get(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId())) +===================================================================== +Found a 5 line (34 tokens) duplication in the following files: +Starting at line 146 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 159 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 214 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java + + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().is2xxSuccessful()); + + // ensure it is really deleted + mockMvc.perform(get(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isNotFound()); +===================================================================== +Found a 6 line (34 tokens) duplication in the following files: +Starting at line 150 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResourceTest.java +Starting at line 162 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResourceTest.java +Starting at line 173 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResourceTest.java + + .andExpect(status().isAccepted()); + + // check if hiding is in progress + this.mockMvc + .perform(get(API_DATA_ACQUISITION_PROJECTS_URI + "/" + projectId + "/shadows/1.0.0/action")) + .andExpect(status().isOk()).andExpect(jsonPath("$.action", is(Action.HIDE.name()))); +===================================================================== +Found a 5 line (34 tokens) duplication in the following files: +Starting at line 79 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionImageResourceTest.java +Starting at line 98 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionImageResourceTest.java + + public void testUploadQuestionImageResource() throws Exception { + MockMultipartFile attachment = + new MockMultipartFile("image", "image.png", "image/png", "fakeimage".getBytes()); + QuestionImageMetadata questionImageMetadata = + UnitTestCreateDomainObjectUtils.buildQuestionImageMetadata("projectid", "questionid"); +===================================================================== +Found a 5 line (34 tokens) duplication in the following files: +Starting at line 127 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 153 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 342 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java + + UnitTestCreateDomainObjectUtils.buildQuestion(project.getId(), 123, "instrument-Id"); + // Act and Assert + // create the Question with the given id + mockMvc.perform(post(API_QUESTIONS_URI).content(TestUtil.convertObjectToJsonBytes(question)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); +===================================================================== +Found a 5 line (34 tokens) duplication in the following files: +Starting at line 156 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 322 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java + + mockMvc.perform(post(API_QUESTIONS_URI).content(TestUtil.convertObjectToJsonBytes(question)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); + + // assert that the question exists + mockMvc.perform(get(API_QUESTIONS_URI + "/" + question.getId())).andExpect(status().isOk()); +===================================================================== +Found a 5 line (34 tokens) duplication in the following files: +Starting at line 102 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionImageShadowCopyServiceTest.java +Starting at line 169 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionImageShadowCopyServiceTest.java + + equalTo("/questions/que-" + PROJECT_ID + "-ins1-1.1$-1.0.0/images/TestFileName.PNG")); + + List expectedFiles = new ArrayList<>(); + expectedFiles.add("/questions/que-" + PROJECT_ID + "-ins1-1.1$/images/TestFileName.PNG"); + expectedFiles.add("/questions/que-" + PROJECT_ID + "-ins1-1.1$-1.0.0/images/TestFileName.PNG"); +===================================================================== +Found a 5 line (34 tokens) duplication in the following files: +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 116 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 143 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 170 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 207 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 227 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 283 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 59 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentVersionsResourceTest.java + + public void testUploadValidAttachment() throws Exception { + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); + SurveyAttachmentMetadata surveyAttachmentMetadata = UnitTestCreateDomainObjectUtils + .buildSurveyAttachmentMetadata("projectid", 1); +===================================================================== +Found a 7 line (34 tokens) duplication in the following files: +Starting at line 100 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 125 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 134 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 152 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 161 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 179 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 272 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + .andExpect(status().isCreated()); + + // read the created attachment and check the version + mockMvc.perform( + get("/api/surveys/" + surveyAttachmentMetadata.getSurveyId() + "/attachments")) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.[0].surveyId", is(surveyAttachmentMetadata.getSurveyId()))) +===================================================================== +Found a 3 line (34 tokens) duplication in the following files: +Starting at line 93 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 297 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 323 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 335 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 110 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java +Starting at line 117 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java + + mockMvc.perform(put(API_SURVEYS_URI + "/" + survey.getId()) + .content(TestUtil.convertObjectToJsonBytes(survey)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 5 line (34 tokens) duplication in the following files: +Starting at line 115 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 381 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); + + // create the survey with the given id + mockMvc.perform(post(API_SURVEYS_URI).content(TestUtil.convertObjectToJsonBytes(survey)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); +===================================================================== +Found a 5 line (34 tokens) duplication in the following files: +Starting at line 118 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 297 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 323 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + mockMvc.perform(post(API_SURVEYS_URI).content(TestUtil.convertObjectToJsonBytes(survey)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); + + // read the survey under the new url + mockMvc.perform(get(API_SURVEYS_URI + "/" + survey.getId())).andExpect(status().isOk()); +===================================================================== +Found a 6 line (34 tokens) duplication in the following files: +Starting at line 131 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 146 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 184 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + public void testCreateSurveyWithMixedMethodDataType() throws Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + rdcProjectRepository.save(project); + + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); + survey.setDataType(I18nString.builder().de("Mixed Methods").en("Mixed Methods").build()); +===================================================================== +Found a 3 line (34 tokens) duplication in the following files: +Starting at line 139 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 154 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 177 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 194 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 215 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 234 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 397 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 82 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java +Starting at line 103 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java + + mockMvc.perform(put(API_SURVEYS_URI + "/" + survey.getId()) + .content(TestUtil.convertObjectToJsonBytes(survey)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) +===================================================================== +Found a 7 line (34 tokens) duplication in the following files: +Starting at line 250 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 267 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 284 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + .andExpect(jsonPath("$.errors[0].property", is("end"))) + .andExpect(jsonPath("$.errors[0].entity", is("Survey"))) + .andExpect(jsonPath("$.errors[0].message", is("global.error.import.json-parsing-error"))); + } + + @Test + public void testCreateSurveyWithUnparsableSampleSize() throws Exception { +===================================================================== +Found a 4 line (34 tokens) duplication in the following files: +Starting at line 102 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/service/UserServiceTest.java +Starting at line 119 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/service/UserServiceTest.java + + user.setResetKey("1234"); + userRepository.save(user); + Optional maybeUser = userService.completePasswordReset("johndoe2", user.getResetKey()); + assertThat(maybeUser.isPresent()).isFalse(); +===================================================================== +Found a 5 line (34 tokens) duplication in the following files: +Starting at line 143 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 871 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "var1", 1, surveyNumbers); + + // create the variable with the given id + mockMvc.perform(post(API_VARIABLES_URI).content(TestUtil.convertObjectToJsonBytes(variable)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); +===================================================================== +Found a 7 line (34 tokens) duplication in the following files: +Starting at line 527 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 564 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 583 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 641 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + accessWays.add("WrongAccessWay"); + + List surveyNumbers = new ArrayList<>(); + surveyNumbers.add(1); + + Variable variable = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "var1", 1, surveyNumbers); +===================================================================== +Found a 5 line (34 tokens) duplication in the following files: +Starting at line 619 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 857 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + .en(ScaleLevels.ORDINAL.getEn()).build()); + + // create the variable with the given id + mockMvc.perform(put(API_VARIABLES_URI + "/" + variable.getId()) + .content(TestUtil.convertObjectToJsonBytes(variable)) +===================================================================== +Found a 8 line (34 tokens) duplication in the following files: +Starting at line 36 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/common/domain/QAbstractShadowableRdcDomainObject.java +Starting at line 49 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 53 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QDataSet.java +Starting at line 49 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java +Starting at line 45 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/domain/QDataAcquisitionProject.java +Starting at line 61 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/domain/QQuestion.java +Starting at line 42 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSubDocument.java +Starting at line 48 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSubDocument.java +Starting at line 44 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSubDocument.java +Starting at line 46 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSubDocument.java +Starting at line 44 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySubDocument.java +Starting at line 46 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSubDocument.java +Starting at line 51 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QSurvey.java +Starting at line 71 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/QVariable.java + + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + public final StringPath masterId = createString("masterId"); + + public final BooleanPath shadow = createBoolean("shadow"); +===================================================================== +Found a 9 line (34 tokens) duplication in the following files: +Starting at line 35 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/common/domain/QTask.java +Starting at line 40 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/domain/QConcept.java +Starting at line 46 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java +Starting at line 30 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/domain/QDaraUpdateQueueItem.java +Starting at line 34 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/domain/QShadowCopyQueueItem.java +Starting at line 37 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSubDocument.java +Starting at line 41 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSubDocument.java +Starting at line 41 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySubDocument.java +Starting at line 30 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/domain/QElasticsearchIndicesVersion.java +Starting at line 36 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/domain/QElasticsearchUpdateQueueItem.java +Starting at line 48 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QSurvey.java + + public final StringPath id = createString("id"); + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + public final StringPath location = createString("location"); +===================================================================== +Found a 1 line (34 tokens) duplication in the following files: +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/domain/QConcept.java +Starting at line 36 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 56 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSubDocument.java +Starting at line 49 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSubDocument.java + + public final ListPath authors = this.createList("authors", eu.dzhw.fdz.metadatamanagement.common.domain.Person.class, eu.dzhw.fdz.metadatamanagement.common.domain.QPerson.class, PathInits.DIRECT2); +===================================================================== +Found a 1 line (34 tokens) duplication in the following files: +Starting at line 36 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 49 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java + + public final ListPath dataCurators = this.createList("dataCurators", eu.dzhw.fdz.metadatamanagement.common.domain.Person.class, eu.dzhw.fdz.metadatamanagement.common.domain.QPerson.class, PathInits.DIRECT2); +===================================================================== +Found a 1 line (34 tokens) duplication in the following files: +Starting at line 46 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 70 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 39 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSubDocument.java + + public final ListPath institutions = this.createList("institutions", eu.dzhw.fdz.metadatamanagement.common.domain.I18nString.class, eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString.class, PathInits.DIRECT2); +===================================================================== +Found a 1 line (34 tokens) duplication in the following files: +Starting at line 46 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 61 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 87 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 95 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 125 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 39 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSubDocument.java +Starting at line 53 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSubDocument.java +Starting at line 69 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationSearchDocument.java + + public final ListPath institutions = this.createList("institutions", eu.dzhw.fdz.metadatamanagement.common.domain.I18nString.class, eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString.class, PathInits.DIRECT2); +===================================================================== +Found a 7 line (34 tokens) duplication in the following files: +Starting at line 43 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageNestedDocument.java +Starting at line 57 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySubDocument.java + + public final StringPath masterId = createString("masterId"); + + public final BooleanPath shadow = createBoolean("shadow"); + + public final StringPath successorId = createString("successorId"); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString title; +===================================================================== +Found a 12 line (34 tokens) duplication in the following files: +Starting at line 72 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 85 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 72 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java +Starting at line 99 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + public final ListPath instruments = this.createList("instruments", InstrumentSubDocument.class, QInstrumentSubDocument.class, PathInits.DIRECT2); + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + //inherited + public final StringPath masterId = _super.masterId; + + public final ListPath nestedConcepts = this.createList("nestedConcepts", ConceptNestedDocument.class, QConceptNestedDocument.class, PathInits.DIRECT2); +===================================================================== +Found a 1 line (34 tokens) duplication in the following files: +Starting at line 116 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 53 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSubDocument.java + + public final ListPath sponsors = _super.sponsors; +===================================================================== +Found a 6 line (34 tokens) duplication in the following files: +Starting at line 55 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java +Starting at line 39 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSubDocument.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString description; + + // inherited + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString format; + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString guiLabels; +===================================================================== +Found a 10 line (34 tokens) duplication in the following files: +Starting at line 60 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 60 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 64 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java +Starting at line 84 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString guiLabels; + + //inherited + public final BooleanPath hidden = _super.hidden; + + //inherited + public final StringPath id = _super.id; + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; +===================================================================== +Found a 3 line (34 tokens) duplication in the following files: +Starting at line 150 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 170 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 159 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java +Starting at line 182 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + this.guiLabels = inits.isInitialized("guiLabels") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("guiLabels")) : null; + this.nestedDataPackage = inits.isInitialized("nestedDataPackage") ? new QDataPackageNestedDocument(forProperty("nestedDataPackage"), inits.get("nestedDataPackage")) : null; + this.release = inits.isInitialized("release") ? new eu.dzhw.fdz.metadatamanagement.projectmanagement.domain.QRelease(forProperty("release")) : null; +===================================================================== +Found a 4 line (33 tokens) duplication in the following files: +Starting at line 56 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/rest/I18nResourceController.java +Starting at line 33 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/UnitValueResource.java + + defaultValue = "de") String locale) { + return ResponseEntity.ok() + .cacheControl(CacheControl.maxAge(0, TimeUnit.DAYS).mustRevalidate().cachePublic()) + .eTag(ETAG.toString()) +===================================================================== +Found a 5 line (33 tokens) duplication in the following files: +Starting at line 103 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResource.java +Starting at line 107 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResource.java +Starting at line 103 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResource.java +Starting at line 105 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResource.java +Starting at line 103 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResource.java + + @RequestMapping(path = "/concepts/{conceptId}/attachments/{filename:.+}", + method = RequestMethod.PUT) + @Secured(value = {AuthoritiesConstants.PUBLISHER, AuthoritiesConstants.DATA_PROVIDER}) + public ResponseEntity update( + @Valid @RequestBody ConceptAttachmentMetadata conceptAttachmentMetadata) { +===================================================================== +Found a 7 line (33 tokens) duplication in the following files: +Starting at line 49 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentVersionsResource.java +Starting at line 49 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentVersionsResource.java +Starting at line 50 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentVersionsResource.java +Starting at line 50 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentVersionsResource.java +Starting at line 48 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentVersionsResource.java + + if (conceptAttachmentVersions == null) { + return ResponseEntity.notFound().build(); + } + + return ResponseEntity.ok() + .cacheControl(CacheControl.noStore()) + .body(conceptAttachmentVersions); +===================================================================== +Found a 3 line (33 tokens) duplication in the following files: +Starting at line 113 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptAttachmentService.java +Starting at line 154 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentService.java +Starting at line 165 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentService.java +Starting at line 158 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentService.java + + .regex("^" + Pattern.quote("/concepts/") + ".*" + Pattern.quote("/attachments/"))); + Iterable files = this.operations.find(query); + files.forEach(file -> { +===================================================================== +Found a 6 line (33 tokens) duplication in the following files: +Starting at line 97 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageOverviewResource.java +Starting at line 94 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetReportResource.java + + @PathVariable("dataPackageId") String dataPackageId, @RequestParam("version") String version) + throws IOException, TemplateException, TemplateIncompleteException { + + // Handles no empty latex templates + if (!templateZip.isEmpty()) { + Path zipTmpFilePath = Files.createTempFile(dataPackageId.replace("!", ""), ".zip"); +===================================================================== +Found a 8 line (33 tokens) duplication in the following files: +Starting at line 37 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/repository/InstrumentRepository.java +Starting at line 38 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/repository/SurveyRepository.java + + @Param("dataAcquisitionProjectId") String dataAcquisitionProjectId); + + @RestResource(exported = false) + List findIdsByNumberAndDataAcquisitionProjectId(Integer number, + String dataAcquisitionProjectId); + + @RestResource(exported = false) + Stream streamIdsBySurveyIdsContaining(String surveyId); +===================================================================== +Found a 4 line (33 tokens) duplication in the following files: +Starting at line 100 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java +Starting at line 116 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java +Starting at line 219 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java +Starting at line 244 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java +Starting at line 272 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java +Starting at line 300 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java +Starting at line 379 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java + + Locale locale = Locale.forLanguageTag(user.getLangKey()); + Context context = new Context(locale); + context.setVariable("user", user); + context.setVariable("baseUrl", baseUrl); +===================================================================== +Found a 3 line (33 tokens) duplication in the following files: +Starting at line 227 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java +Starting at line 309 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java +Starting at line 388 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java + + String subject = messageSource.getMessage(subjectKey, new Object[] {projectId}, locale); + sendEmail(sender, new String[] {user.getEmail()}, null, null, subject, content, false, true); + }); +===================================================================== +Found a 19 line (33 tokens) duplication in the following files: +Starting at line 78 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResource.java +Starting at line 103 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResource.java + + dataAcquisitionProjectManagementService.hideShadows(optional.get()); + } else { + return ResponseEntity.notFound().build(); + } + + return ResponseEntity.accepted().build(); + } + + /** + * Unhide the shadow copies of the given project with the given version. + * + * @param id The id of the project + * @param version the version of the shadows to hide + * + * @return ACCEPTED if the hiding task has been started + * @throws ShadowUnhidingNotAllowedException Thrown if the given project version is already + * unhidden + */ + @DeleteMapping("/data-acquisition-projects/{id}/shadows/{version}/hidden") +===================================================================== +Found a 5 line (33 tokens) duplication in the following files: +Starting at line 116 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/UserResource.java +Starting at line 132 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/UserResource.java + + @RequestMapping(value = "/users/{login}/public", method = RequestMethod.GET, + produces = MediaType.APPLICATION_JSON_VALUE) + @Secured({AuthoritiesConstants.ADMIN, AuthoritiesConstants.DATA_PROVIDER, + AuthoritiesConstants.PUBLISHER}) + public ResponseEntity getUserPublic(@PathVariable String login) { +===================================================================== +Found a 14 line (33 tokens) duplication in the following files: +Starting at line 31 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/UniqueVariableNameInDataSetValidator.java +Starting at line 22 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/ValidDerivedVariablesIdentifierValidator.java +Starting at line 21 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/ValidRepeatedMeasurementIdentifierValidator.java +Starting at line 24 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/validation/ValidVariableIdNameValidator.java + + public void initialize(UniqueVariableNameInDataSet constraintAnnotation) {} + + /* + * (non-Javadoc) + * + * @see javax.validation.ConstraintValidator#isValid(java.lang.Object, + * javax.validation.ConstraintValidatorContext) + */ + @Override + public boolean isValid(Variable variable, ConstraintValidatorContext context) { + if (variable.isShadow()) { + return true; + } else { + if (StringUtils.isEmpty(variable.getName()) && StringUtils.isEmpty(variable.getDataSetId())) { +===================================================================== +Found a 9 line (33 tokens) duplication in the following files: +Starting at line 62 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 73 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 73 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 58 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 66 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 64 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionImageResourceTest.java +Starting at line 71 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 73 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 72 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 71 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResponseRateImageResourceTest.java + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac) + .build(); + } + + @After + public void cleanUp() { + this.conceptRepository.deleteAll(); +===================================================================== +Found a 9 line (33 tokens) duplication in the following files: +Starting at line 78 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 71 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAccessWaysResourceControllerTest.java +Starting at line 81 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 59 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/StudySeriesesResourceControllerTest.java +Starting at line 70 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + + questionRepository.deleteAll(); + elasticsearchUpdateQueueItemRepository.deleteAll(); + elasticsearchAdminService.recreateAllIndices(); + javersService.deleteAll(); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER) + public void testCreateConcept() throws IOException, Exception { +===================================================================== +Found a 4 line (33 tokens) duplication in the following files: +Starting at line 380 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 379 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 357 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 228 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResponseRateImageResourceTest.java + + "/api/data-packages/" + dataPackageId + "/attachments/" + metadata.getFileName())) + .andExpect(status().isBadRequest()).andExpect(jsonPath("$.errors[0].message", + containsString("global.error.shadow-delete-not-allowed"))); + } +===================================================================== +Found a 5 line (33 tokens) duplication in the following files: +Starting at line 100 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 127 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 156 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java + + mockMvc.perform(get(API_DATAPACKAGE_URI)).andExpect(status().isOk()) + .andExpect(jsonPath("$.content.length()", is(0))); + + // get the empty list of pinned data packages + mockMvc.perform(get(API_DATAPACKAGE_URI + "?pinned=true")).andExpect(status().isOk()) +===================================================================== +Found a 6 line (33 tokens) duplication in the following files: +Starting at line 289 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 350 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java + + mockMvc.perform(delete(API_DATAPACKAGE_URI + "/" + dataPackage.getId())) + .andExpect(status().isBadRequest()).andExpect(jsonPath("$.errors[0].message", + containsString("global.error.shadow-delete-not-allowed"))); + } + + @Test +===================================================================== +Found a 9 line (33 tokens) duplication in the following files: +Starting at line 60 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DeleteAllDataPackagesResourceControllerTest.java +Starting at line 78 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java + + dataPackageRepository.deleteAll(); + javersService.deleteAll(); + elasticsearchUpdateQueueItemRepository.deleteAll(); + elasticsearchAdminService.recreateAllIndices(); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER) + public void testDeleteAllDataPackagesOfShadowCopyProject() throws Exception { +===================================================================== +Found a 6 line (33 tokens) duplication in the following files: +Starting at line 77 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java +Starting at line 114 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java +Starting at line 145 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java + + public void createShadowCopy() throws Exception { + DataPackageAttachmentMetadata master = + UnitTestCreateDomainObjectUtils.buildDataPackageAttachmentMetadata(PROJECT_ID); + master.generateId(); + master.setMasterId(master.getId()); + createTestFileForAttachment(master); +===================================================================== +Found a 7 line (33 tokens) duplication in the following files: +Starting at line 209 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java +Starting at line 209 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java +Starting at line 213 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java +Starting at line 210 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionImageShadowCopyServiceTest.java +Starting at line 206 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java + + shadow.setDataPackageId(master.getDataPackageId() + "-" + version); + shadow.setDataAcquisitionProjectId(shadow.getDataAcquisitionProjectId() + "-" + version); + shadow.generateId(); + return shadow; + } + + private void createTestFileForAttachment(DataPackageAttachmentMetadata metadata) throws Exception { +===================================================================== +Found a 6 line (33 tokens) duplication in the following files: +Starting at line 99 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageShadowCopyServiceTest.java +Starting at line 105 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetShadowCopyServiceTest.java +Starting at line 99 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentShadowCopyServiceTest.java +Starting at line 106 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionShadowCopyServiceTest.java +Starting at line 103 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyShadowCopyServiceTest.java +Starting at line 100 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/VariableShadowCopyServiceTest.java + + dataPackageRepository.saveAll(Arrays.asList(master, shadow)); + + shadowCopyService.createShadowCopies(project.getId(), project.getRelease(), + "1.0.0"); + + long count = dataPackageRepository.count(); +===================================================================== +Found a 9 line (33 tokens) duplication in the following files: +Starting at line 61 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DeleteAllDateSetsResourceControllerTest.java +Starting at line 64 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/DeleteAllInstrumentsResourceControllerTest.java +Starting at line 58 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/DeleteAllQuestionsResourceControllerTest.java +Starting at line 62 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/DeleteAllSurveysResourceControllerTest.java +Starting at line 61 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/DeleteAllVariablesResourceControllerTest.java + + dataSetRepo.deleteAll(); + javersService.deleteAll(); + elasticsearchUpdateQueueItemRepository.deleteAll(); + elasticsearchAdminService.recreateAllIndices(); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.DATA_PROVIDER) + public void testDeleteAllDataSetsOfProject() throws Exception { +===================================================================== +Found a 8 line (33 tokens) duplication in the following files: +Starting at line 48 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailServiceTest.java +Starting at line 65 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailServiceTest.java + + public void testSendActivationEmail() throws Exception { + // Arrange + User user = User.builder().langKey("de") + .email("anyMail@localhost.com") + .build(); + + // Act + Future futureVoid = this.mailService.sendActivationEmail(user); +===================================================================== +Found a 17 line (33 tokens) duplication in the following files: +Starting at line 26 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectLastReleaseResourceTest.java +Starting at line 26 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectReleasesResourceTest.java +Starting at line 45 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResourceTest.java +Starting at line 36 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + +public class DataAcquisitionProjectLastReleaseResourceTest extends AbstractTest { + private static final String API_DATA_ACQUISITION_PROJECTS_URI = "/api/data-acquisition-projects"; + + @Autowired + private WebApplicationContext wac; + + @Autowired + private DataAcquisitionProjectRepository dataAcquisitionProjectRepository; + + @Autowired + private ElasticsearchUpdateQueueItemRepository elasticsearchUpdateQueueItemRepository; + + @Autowired + private ElasticsearchAdminService elasticsearchAdminService; + + @Autowired + private JaversService javersService; +===================================================================== +Found a 6 line (33 tokens) duplication in the following files: +Starting at line 122 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 177 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 236 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 298 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java + + private DataAcquisitionProject buildValidProject() { + //Arrange + //Project + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + project.getConfiguration().setDataPackagesState(new ProjectState(true, true)); + this.rdcProjectRepository.save(project); +===================================================================== +Found a 8 line (33 tokens) duplication in the following files: +Starting at line 330 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 631 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 815 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + mockMvc.perform(get(API_QUESTIONS_URI + "/" + question.getId())) + .andExpect(status().isNotFound()); + + // check that there are no question documents anymore + assertThat(elasticsearchAdminService.countAllDocuments(), equalTo(0L)); + } + + @Test +===================================================================== +Found a 9 line (33 tokens) duplication in the following files: +Starting at line 33 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/common/domain/QAbstractShadowableRdcDomainObject.java +Starting at line 36 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QAbstractNestedSubDocument.java +Starting at line 66 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java + + public final StringPath id = _super.id; + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + public final StringPath masterId = createString("masterId"); +===================================================================== +Found a 5 line (33 tokens) duplication in the following files: +Starting at line 56 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/common/domain/QTask.java +Starting at line 84 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QDataSet.java +Starting at line 51 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QAbstractNestedSubDocument.java +Starting at line 52 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptNestedDocument.java +Starting at line 108 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 56 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSubDocument.java +Starting at line 58 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageNestedDocument.java +Starting at line 152 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 70 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSubDocument.java +Starting at line 62 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetNestedDocument.java +Starting at line 133 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java +Starting at line 76 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSubDocument.java +Starting at line 62 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentNestedDocument.java +Starting at line 133 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 72 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSubDocument.java +Starting at line 64 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionNestedDocument.java +Starting at line 152 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 70 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSubDocument.java +Starting at line 54 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationNestedDocument.java +Starting at line 97 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationSearchDocument.java +Starting at line 62 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveyNestedDocument.java +Starting at line 142 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java +Starting at line 74 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySubDocument.java +Starting at line 64 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableNestedDocument.java +Starting at line 164 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java +Starting at line 70 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSubDocument.java + + public QTask(Path path) { + this(path.getType(), path.getMetadata(), PathInits.getFor(path.getMetadata(), INITS)); + } + + public QTask(PathMetadata metadata) { +===================================================================== +Found a 3 line (33 tokens) duplication in the following files: +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/domain/QConcept.java +Starting at line 34 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 54 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSubDocument.java +Starting at line 101 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 47 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSubDocument.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractRdcDomainObject _super = new eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractRdcDomainObject(this); + + public final ListPath authors = this.createList("authors", eu.dzhw.fdz.metadatamanagement.common.domain.Person.class, eu.dzhw.fdz.metadatamanagement.common.domain.QPerson.class, PathInits.DIRECT2); +===================================================================== +Found a 4 line (33 tokens) duplication in the following files: +Starting at line 53 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/domain/QConcept.java +Starting at line 73 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 71 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java +Starting at line 93 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 137 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 115 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 127 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java +Starting at line 79 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QSurvey.java + + public final QTags tags = new QTags(forProperty("tags")); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString title = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("title")); +===================================================================== +Found a 4 line (33 tokens) duplication in the following files: +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QDataSet.java +Starting at line 23 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java +Starting at line 26 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/domain/QQuestion.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/domain/QRelatedPublication.java +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 29 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java +Starting at line 22 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QSurvey.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/QVariable.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractShadowableRdcDomainObject _super = new eu.dzhw.fdz.metadatamanagement.common.domain.QAbstractShadowableRdcDomainObject(this); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("annotations")); +===================================================================== +Found a 3 line (33 tokens) duplication in the following files: +Starting at line 44 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 85 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 93 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 37 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSubDocument.java +Starting at line 51 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSubDocument.java +Starting at line 67 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationSearchDocument.java + + public final StringPath id = createString("id"); + + public final ListPath institutions = this.createList("institutions", eu.dzhw.fdz.metadatamanagement.common.domain.I18nString.class, eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString.class, PathInits.DIRECT2); +===================================================================== +Found a 9 line (33 tokens) duplication in the following files: +Starting at line 46 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 50 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QDataSet.java +Starting at line 57 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 39 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSubDocument.java +Starting at line 45 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSubDocument.java + + public final ListPath institutions = this.createList("institutions", eu.dzhw.fdz.metadatamanagement.common.domain.I18nString.class, eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString.class, PathInits.DIRECT2); + + //inherited + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + public final StringPath masterId = createString("masterId"); +===================================================================== +Found a 4 line (33 tokens) duplication in the following files: +Starting at line 38 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QDataSet.java +Starting at line 38 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java +Starting at line 43 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 53 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 54 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 21 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QPopulation.java +Starting at line 20 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/QFilterDetails.java +Starting at line 20 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/QGenerationDetails.java + + public final StringPath dataPackageId = createString("dataPackageId"); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString description = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("description")); +===================================================================== +Found a 4 line (33 tokens) duplication in the following files: +Starting at line 72 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QDataSet.java +Starting at line 87 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/domain/QQuestion.java +Starting at line 137 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java + + public final ListPath> surveyNumbers = this.>createList("surveyNumbers", Integer.class, NumberPath.class, PathInits.DIRECT2); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString type = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("type")); +===================================================================== +Found a 1 line (33 tokens) duplication in the following files: +Starting at line 98 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QDataSet.java +Starting at line 91 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSubDocument.java + + this.format = inits.isInitialized("format") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("format")) : null; +===================================================================== +Found a 9 line (33 tokens) duplication in the following files: +Starting at line 28 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java +Starting at line 31 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/domain/QQuestion.java +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSubDocument.java +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSubDocument.java +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSubDocument.java +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSubDocument.java +Starting at line 29 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/usermanagement/domain/QUser.java + + public final ListPath conceptIds = this.createList("conceptIds", String.class, StringPath.class, PathInits.DIRECT2); + + //inherited + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + public final StringPath dataAcquisitionProjectId = createString("dataAcquisitionProjectId"); +===================================================================== +Found a 4 line (33 tokens) duplication in the following files: +Starting at line 84 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/domain/QQuestion.java +Starting at line 133 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java + + public final QTechnicalRepresentation technicalRepresentation = new QTechnicalRepresentation(forProperty("technicalRepresentation")); + + // custom + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString topic = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("topic")); +===================================================================== +Found a 6 line (33 tokens) duplication in the following files: +Starting at line 33 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/domain/QRelatedPublication.java +Starting at line 40 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationSearchDocument.java + + public final StringPath createdBy = _super.createdBy; + + //inherited + public final DateTimePath createdDate = _super.createdDate; + + public final ListPath dataPackageIds = this.createList("dataPackageIds", String.class, StringPath.class, PathInits.DIRECT2); +===================================================================== +Found a 1 line (33 tokens) duplication in the following files: +Starting at line 65 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QAbstractNestedSubDocument.java +Starting at line 149 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java + + this.completeTitle = inits.isInitialized("completeTitle") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("completeTitle")) : null; +===================================================================== +Found a 1 line (33 tokens) duplication in the following files: +Starting at line 72 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptNestedDocument.java +Starting at line 71 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSubDocument.java +Starting at line 78 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageNestedDocument.java +Starting at line 86 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSubDocument.java +Starting at line 88 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSubDocument.java +Starting at line 93 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySubDocument.java + + this.title = inits.isInitialized("title") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("title")) : null; +===================================================================== +Found a 1 line (33 tokens) duplication in the following files: +Starting at line 123 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 158 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java +Starting at line 112 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationSearchDocument.java + + this.guiLabels = inits.isInitialized("guiLabels") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("guiLabels")) : null; +===================================================================== +Found a 5 line (33 tokens) duplication in the following files: +Starting at line 45 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageNestedDocument.java +Starting at line 57 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSubDocument.java +Starting at line 47 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveyNestedDocument.java +Starting at line 59 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySubDocument.java + + public final BooleanPath shadow = createBoolean("shadow"); + + public final StringPath successorId = createString("successorId"); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString title; +===================================================================== +Found a 9 line (33 tokens) duplication in the following files: +Starting at line 108 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 95 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java + + public final ListPath relatedPublications = this.createList("relatedPublications", RelatedPublicationSubDocument.class, QRelatedPublicationSubDocument.class, PathInits.DIRECT2); + + public final eu.dzhw.fdz.metadatamanagement.projectmanagement.domain.QRelease release; + + //inherited + public final BooleanPath shadow = _super.shadow; + + //inherited + public final ListPath sponsors = _super.sponsors; +===================================================================== +Found a 1 line (33 tokens) duplication in the following files: +Starting at line 107 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java +Starting at line 61 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSubDocument.java + + public final ListPath subDataSets; +===================================================================== +Found a 1 line (33 tokens) duplication in the following files: +Starting at line 167 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java +Starting at line 152 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 173 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 161 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java +Starting at line 185 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + this.release = inits.isInitialized("release") ? new eu.dzhw.fdz.metadatamanagement.projectmanagement.domain.QRelease(forProperty("release")) : null; +===================================================================== +Found a 9 line (33 tokens) duplication in the following files: +Starting at line 69 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 102 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + public final StringPath lastModifiedBy = _super.lastModifiedBy; + + //inherited + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + //inherited + public final StringPath masterId = _super.masterId; + + public final ListPath nestedConcepts = this.createList("nestedConcepts", ConceptNestedDocument.class, QConceptNestedDocument.class, PathInits.DIRECT2); +===================================================================== +Found a 5 line (33 tokens) duplication in the following files: +Starting at line 51 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java +Starting at line 35 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QSurvey.java +Starting at line 42 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/QVariable.java + + public final ListPath dataSets = this.createList("dataSets", DataSetSubDocument.class, QDataSetSubDocument.class, PathInits.DIRECT2); + + // custom + // inherited + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString dataType = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(_super.dataType); +===================================================================== +Found a 5 line (33 tokens) duplication in the following files: +Starting at line 55 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java +Starting at line 38 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QSurvey.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString dataType = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(_super.dataType); + + // custom + // inherited + public final eu.dzhw.fdz.metadatamanagement.common.domain.QPeriod fieldPeriod = new eu.dzhw.fdz.metadatamanagement.common.domain.QPeriod(_super.fieldPeriod); +===================================================================== +Found a 1 line (33 tokens) duplication in the following files: +Starting at line 82 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableNestedDocument.java +Starting at line 84 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSubDocument.java + + this.label = inits.isInitialized("label") ? new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("label")) : null; +===================================================================== +Found a 5 line (33 tokens) duplication in the following files: +Starting at line 95 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java +Starting at line 65 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/QVariable.java + + public final ListPath instruments = this.createList("instruments", InstrumentSubDocument.class, QInstrumentSubDocument.class, PathInits.DIRECT2); + + // custom + // inherited + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString label = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(_super.label); +===================================================================== +Found a 7 line (33 tokens) duplication in the following files: +Starting at line 28 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/usermanagement/domain/QOAuth2AuthenticationAccessToken.java +Starting at line 22 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/usermanagement/domain/QOAuth2AuthenticationRefreshToken.java + + public final StringPath refreshToken = createString("refreshToken"); + + public final ArrayPath token = createArray("token", byte[].class); + + public final StringPath tokenId = createString("tokenId"); + + public final StringPath username = createString("username"); +===================================================================== +Found a 12 line (32 tokens) duplication in the following files: +Starting at line 38 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/rest/filter/CachingHttpHeadersFilter.java +Starting at line 27 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/rest/filter/StaticResourcesProductionFilter.java + + } + + @Override + public void destroy() { + // Nothing to destroy + } + + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) + throws IOException, ServletException { + + if (response instanceof HttpServletResponse && request instanceof HttpServletRequest) { +===================================================================== +Found a 7 line (32 tokens) duplication in the following files: +Starting at line 24 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/repository/ConceptRepository.java +Starting at line 39 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/repository/DataPackageRepository.java +Starting at line 43 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/repository/VariableRepository.java + + List findSubDocumentsByIdIn(Collection conceptIds); + + @RestResource(exported = false) + Stream streamAllIdAndVersionsBy(); + + @RestResource(exported = false) + Stream streamIdsByIdIn(Collection conceptIds); +===================================================================== +Found a 4 line (32 tokens) duplication in the following files: +Starting at line 91 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResource.java +Starting at line 95 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResource.java +Starting at line 91 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResource.java +Starting at line 93 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResource.java +Starting at line 91 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResource.java + + @RequestMapping(path = "/concepts/{conceptId}/attachments/{filename:.+}", + method = RequestMethod.DELETE) + @Secured(value = {AuthoritiesConstants.PUBLISHER, AuthoritiesConstants.DATA_PROVIDER}) + public ResponseEntity delete(@PathVariable("conceptId") String conceptId, +===================================================================== +Found a 4 line (32 tokens) duplication in the following files: +Starting at line 43 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentVersionsResource.java +Starting at line 39 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResource.java +Starting at line 42 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentVersionsResource.java +Starting at line 39 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResource.java +Starting at line 43 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentVersionsResource.java +Starting at line 39 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResource.java +Starting at line 43 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentVersionsResource.java +Starting at line 39 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResource.java +Starting at line 39 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResource.java +Starting at line 42 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentVersionsResource.java +Starting at line 39 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResource.java + + @PathVariable String filename, + @RequestParam(name = "limit", defaultValue = "5") Integer limit, + @RequestParam(name = "skip", defaultValue = "0") Integer skip) { + List conceptAttachmentVersions = conceptAttachmentVersionsService +===================================================================== +Found a 7 line (32 tokens) duplication in the following files: +Starting at line 245 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptManagementService.java +Starting at line 53 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/service/RelatedPublicationManagementService.java + + public Optional read(String id) { + return crudHelper.read(id); + } + + @Override + @Secured(value = {AuthoritiesConstants.PUBLISHER}) + public void delete(Concept concept) { +===================================================================== +Found a 8 line (32 tokens) duplication in the following files: +Starting at line 53 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/DataSet.java +Starting at line 51 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/Instrument.java +Starting at line 50 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/domain/DataAcquisitionProject.java +Starting at line 51 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/domain/Question.java + +@CompoundIndex(def = "{number: 1, dataAcquisitionProjectId: 1}", unique = true) +@EqualsAndHashCode(callSuper = false, of = "id") +@ToString(callSuper = true) +@NoArgsConstructor +@Data +@AllArgsConstructor +@Builder +@ValidShadowId(message = "data-set-management.error.data-set.id.pattern") +===================================================================== +Found a 5 line (32 tokens) duplication in the following files: +Starting at line 303 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java +Starting at line 382 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java + + context.setVariable("dataSetId", dataSetId); + context.setVariable("locale", locale); + context.setVariable("language", language); + context.setVariable("baseUrl", baseUrl); + String content = templateEngine.process("datasetReportGeneratedEmail", context); +===================================================================== +Found a 6 line (32 tokens) duplication in the following files: +Starting at line 73 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResource.java +Starting at line 98 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResource.java + + throws ShadowHidingNotAllowedException { + String shadowId = id + "-" + version; + Optional optional = + dataAcquisitionProjectManagementService.read(shadowId); + if (optional.isPresent()) { + dataAcquisitionProjectManagementService.hideShadows(optional.get()); +===================================================================== +Found a 14 line (32 tokens) duplication in the following files: +Starting at line 119 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyManagementService.java +Starting at line 165 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyManagementService.java +Starting at line 179 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyManagementService.java + + List surveyIds = instrumentChangesProvider.getAffectedSurveyIds(instrument.getId()); + elasticsearchUpdateQueueService.enqueueUpsertsAsync( + () -> surveyRepository.streamIdsByIdIn(surveyIds), ElasticsearchType.surveys); + } + + /** + * Enqueue update of survey search documents when the question is changed. + * + * @param question the updated, created or deleted question. + */ + @HandleAfterCreate + @HandleAfterSave + @HandleAfterDelete + public void onQuestionChanged(Question question) { +===================================================================== +Found a 11 line (32 tokens) duplication in the following files: +Starting at line 20 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/rest/I18nResourceControllerTest.java +Starting at line 16 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataFormatsResourceControllerTest.java +Starting at line 64 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DaraServiceTest.java +Starting at line 16 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveySampleTypesResourceControllerTest.java +Starting at line 16 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/UnitValuesResourceControllerTest.java + + @Autowired + private WebApplicationContext wac; + + private MockMvc mockMvc; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac).build(); + } + + @Test +===================================================================== +Found a 2 line (32 tokens) duplication in the following files: +Starting at line 55 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/service/TaskServiceTest.java +Starting at line 68 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/service/TaskServiceTest.java + + Task taskForError = taskRepo.insert(Task.builder().id(id).state(TaskState.RUNNING).build()); + Task result = taskService.handleErrorTask(taskForError, +===================================================================== +Found a 6 line (32 tokens) duplication in the following files: +Starting at line 79 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 109 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 141 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 173 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 213 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 233 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java + + public void testUploadValidAttachment() throws Exception { + + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); + ConceptAttachmentMetadata conceptAttachmentMetadata = UnitTestCreateDomainObjectUtils + .buildConceptAttachmentMetadata("con-conceptid$"); +===================================================================== +Found a 7 line (32 tokens) duplication in the following files: +Starting at line 93 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 120 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 152 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 184 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 278 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java + + conceptAttachmentMetadata.generateId(); + + // read the created attachment and check the version + mockMvc.perform( + get("/api/concepts/" + conceptAttachmentMetadata.getConceptId() + "/attachments")) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.[0].conceptId", is(conceptAttachmentMetadata.getConceptId()))) +===================================================================== +Found a 6 line (32 tokens) duplication in the following files: +Starting at line 223 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 244 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 242 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 262 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 237 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 258 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 220 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 240 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 217 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 238 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/concepts/attachments") + .file(attachment) + .file(metadata)) + .andExpect(status().isBadRequest()) + .andExpect(jsonPath("$.errors[0].message", + is("concept-management.error.concept-attachment-metadata.type.valid-type"))); +===================================================================== +Found a 3 line (32 tokens) duplication in the following files: +Starting at line 259 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 140 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 99 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java +Starting at line 106 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java + + mockMvc.perform(put("/api/concepts/" + concept.getId()) + .content(TestUtil.convertObjectToJsonBytes(concept)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 2 line (32 tokens) duplication in the following files: +Starting at line 74 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentVersionsResourceTest.java +Starting at line 74 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentVersionsResourceTest.java +Starting at line 74 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentVersionsResourceTest.java +Starting at line 74 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentVersionsResourceTest.java +Starting at line 73 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentVersionsResourceTest.java + + + conceptAttachmentMetadata.getFileName() + "/versions")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(1))); +===================================================================== +Found a 3 line (32 tokens) duplication in the following files: +Starting at line 177 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 98 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 180 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 220 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 246 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 271 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 288 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 305 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 322 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 358 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java + + mockMvc.perform(put("/api/questions/" + question.getId()) + .content(TestUtil.convertObjectToJsonBytes(question)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().is2xxSuccessful()); +===================================================================== +Found a 3 line (32 tokens) duplication in the following files: +Starting at line 197 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 94 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 156 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 196 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 208 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 231 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 253 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 271 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 309 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 83 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 106 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 115 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 124 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java + + mockMvc.perform(put("/api/instruments/" + instrument.getId()) + .content(TestUtil.convertObjectToJsonBytes(instrument)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().is2xxSuccessful()); +===================================================================== +Found a 6 line (32 tokens) duplication in the following files: +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 119 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 152 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 185 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 231 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 250 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 301 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 59 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentVersionsResourceTest.java + + public void testUploadValidAttachment() throws Exception { + + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); + DataPackageAttachmentMetadata dataPackageAttachmentMetadata = + UnitTestCreateDomainObjectUtils.buildDataPackageAttachmentMetadata("projectid"); +===================================================================== +Found a 8 line (32 tokens) duplication in the following files: +Starting at line 101 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 130 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 163 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 196 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 291 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java + + dataPackageAttachmentMetadata.generateId(); + + // read the created attachment and check the version + mockMvc + .perform(get("/api/data-packages/" + + dataPackageAttachmentMetadata.getDataPackageId() + "/attachments")) + .andExpect(status().isOk()) + .andExpect( +===================================================================== +Found a 3 line (32 tokens) duplication in the following files: +Starting at line 274 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 139 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 204 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 260 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 275 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 114 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 121 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java + + mockMvc.perform(put("/api/data-packages/" + dataPackage.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataPackage)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); +===================================================================== +Found a 5 line (32 tokens) duplication in the following files: +Starting at line 295 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 297 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 276 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 276 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + "/api/data-packages/" + dataPackageAttachmentMetadata.getDataPackageId() + "/attachments")) + .andExpect(status().isOk()).andExpect(content().json("[]")); + } + + @Test +===================================================================== +Found a 5 line (32 tokens) duplication in the following files: +Starting at line 100 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 104 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 127 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java + + mockMvc.perform(get(API_DATAPACKAGE_URI)).andExpect(status().isOk()) + .andExpect(jsonPath("$.content.length()", is(0))); + + // get the empty list of pinned data packages + mockMvc.perform(get(API_DATAPACKAGE_URI + "?pinned=true")).andExpect(status().isOk()) +===================================================================== +Found a 5 line (32 tokens) duplication in the following files: +Starting at line 101 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 128 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 185 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java + + .andExpect(jsonPath("$.content.length()", is(0))); + + // get the empty list of pinned data packages + mockMvc.perform(get(API_DATAPACKAGE_URI + "?pinned=true")).andExpect(status().isOk()) + .andExpect(jsonPath("$.content.length()", is(0))); +===================================================================== +Found a 6 line (32 tokens) duplication in the following files: +Starting at line 127 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentShadowCopyServiceTest.java +Starting at line 127 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentShadowCopyServiceTest.java +Starting at line 127 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentShadowCopyServiceTest.java +Starting at line 128 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionImageShadowCopyServiceTest.java +Starting at line 124 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentShadowCopyServiceTest.java + + gridFsOperations.find(new Query()).iterator().forEachRemaining(files::add); + + assertThat(files.size(), equalTo(2)); + + Query shadowQuery = new Query(GridFsCriteria.whereFilename() + .is("/data-packages/stu-" + PROJECT_ID + "$-1.0.0/attachments/filename.txt")); +===================================================================== +Found a 5 line (32 tokens) duplication in the following files: +Starting at line 98 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageShadowCopyServiceTest.java +Starting at line 116 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageShadowCopyServiceTest.java + + DataPackage shadow = createShadow(master, release.getVersion()); + dataPackageRepository.saveAll(Arrays.asList(master, shadow)); + + shadowCopyService.createShadowCopies(project.getId(), project.getRelease(), + "1.0.0"); +===================================================================== +Found a 6 line (32 tokens) duplication in the following files: +Starting at line 118 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageShadowCopyServiceTest.java +Starting at line 125 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetShadowCopyServiceTest.java +Starting at line 118 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentShadowCopyServiceTest.java +Starting at line 126 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionShadowCopyServiceTest.java +Starting at line 122 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyShadowCopyServiceTest.java +Starting at line 119 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/VariableShadowCopyServiceTest.java + + dataPackageRepository.saveAll(Arrays.asList(master, shadow)); + + shadowCopyService.createShadowCopies(project.getId(), project.getRelease(), + "1.0.0"); + + List result = +===================================================================== +Found a 4 line (32 tokens) duplication in the following files: +Starting at line 75 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/AvailableDataSetNumbersResourceControllerTest.java +Starting at line 86 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 111 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 131 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 146 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 184 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 290 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 316 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 354 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + public void testAvailableNumbersIfThereIsOneDataSet() throws Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + rdcProjectRepository.save(project); + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); +===================================================================== +Found a 7 line (32 tokens) duplication in the following files: +Starting at line 104 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 131 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 164 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 196 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 293 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java + + dataSetAttachmentMetadata.generateId(); + + // read the created attachment and check the version + mockMvc.perform( + get("/api/data-sets/" + dataSetAttachmentMetadata.getDataSetId() + "/attachments")) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.[0].dataSetId", is(dataSetAttachmentMetadata.getDataSetId()))) +===================================================================== +Found a 3 line (32 tokens) duplication in the following files: +Starting at line 274 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 170 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 188 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 204 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 219 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 242 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 297 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 335 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 120 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java +Starting at line 129 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java + + mockMvc.perform(put("/api/data-sets/" + dataSet.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataSet)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 7 line (32 tokens) duplication in the following files: +Starting at line 267 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 255 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 306 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + mockMvc.perform(get(API_DATASETS_URI + "/" + dataSet.getId())) + .andExpect(status().isNotFound()); + + elasticsearchUpdateQueueService.processAllQueueItems(); + + // check that there are no more data set documents + assertThat(elasticsearchAdminService.countAllDocuments(), equalTo(0L)); +===================================================================== +Found a 3 line (32 tokens) duplication in the following files: +Starting at line 139 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java +Starting at line 134 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 126 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java + + .andExpect(jsonPath("$[0].description.de", is("hurzDe3"))) + .andExpect(jsonPath("$[0].version", is(equalTo(2)))) + .andExpect(jsonPath("$[1].id", is(dataSet.getId()))) +===================================================================== +Found a 3 line (32 tokens) duplication in the following files: +Starting at line 142 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java +Starting at line 137 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 129 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java + + .andExpect(jsonPath("$[1].description.de", is("hurzDe2"))) + .andExpect(jsonPath("$[1].version", is(equalTo(1)))) + .andExpect(jsonPath("$[2].id", is(dataSet.getId()))) +===================================================================== +Found a 5 line (32 tokens) duplication in the following files: +Starting at line 104 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetShadowCopyServiceTest.java +Starting at line 123 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetShadowCopyServiceTest.java + + DataSet shadow = createShadow(master, release.getVersion()); + dataSetRepository.saveAll(Arrays.asList(master, shadow)); + + shadowCopyService.createShadowCopies(project.getId(), project.getRelease(), + "1.0.0"); +===================================================================== +Found a 3 line (32 tokens) duplication in the following files: +Starting at line 253 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 167 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java + + mockMvc.perform(put("/api/instruments/" + instrument.getId()) + .content(TestUtil.convertObjectToJsonBytes(instrument)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); +===================================================================== +Found a 5 line (32 tokens) duplication in the following files: +Starting at line 324 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 498 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 372 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 411 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 905 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + mockMvc.perform(delete(API_INSTRUMENTS_URI + "/" + instrument.getId())) + .andExpect(status().isBadRequest()) + .andExpect(jsonPath("$.errors[0].message", containsString("global.error.shadow-delete-not-allowed"))); + } +} +===================================================================== +Found a 5 line (32 tokens) duplication in the following files: +Starting at line 98 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentShadowCopyServiceTest.java +Starting at line 116 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentShadowCopyServiceTest.java + + Instrument shadow = createShadow(master, release.getVersion()); + instrumentRepository.saveAll(Arrays.asList(master, shadow)); + + shadowCopyService.createShadowCopies(project.getId(), project.getRelease(), + "1.0.0"); +===================================================================== +Found a 4 line (32 tokens) duplication in the following files: +Starting at line 134 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 142 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java + + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + //delete not created project + mockMvc.perform(delete(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isNotFound()); +===================================================================== +Found a 7 line (32 tokens) duplication in the following files: +Starting at line 459 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 306 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java + + .content(TestUtil.convertObjectToJsonBytes(project)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER, username = PUBLISHER_USERNAME) +===================================================================== +Found a 5 line (32 tokens) duplication in the following files: +Starting at line 105 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionShadowCopyServiceTest.java +Starting at line 124 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionShadowCopyServiceTest.java + + Question shadow = createShadow(master, release.getVersion()); + questionRepository.saveAll(Arrays.asList(master, shadow)); + + shadowCopyService.createShadowCopies(project.getId(), project.getRelease(), + "1.0.0"); +===================================================================== +Found a 7 line (32 tokens) duplication in the following files: +Starting at line 105 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 131 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 122 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + this.mockMvc.perform(get(API_RELATED_PUBLICATION_URI + "/" + relatedPublication.getId())) + .andExpect(status().isOk()); + + elasticsearchUpdateQueueService.processAllQueueItems(); + + // check that there is one dataPackage and one publication document + assertThat(elasticsearchAdminService.countAllDocuments(), equalTo(2L)); +===================================================================== +Found a 7 line (32 tokens) duplication in the following files: +Starting at line 34 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueServiceTest.java +Starting at line 46 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueServiceTest.java + + public void testEnqueuingOfSingleDocument() { + elasticsearchUpdateQueueService.enqueue("testId", ElasticsearchType.variables, + ElasticsearchUpdateQueueAction.DELETE); + + assertThat(itemRepository.count(), is(1L)); + + elasticsearchUpdateQueueService.processAllQueueItems(); +===================================================================== +Found a 3 line (32 tokens) duplication in the following files: +Starting at line 253 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 139 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 154 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 177 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 194 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 215 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 234 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 397 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 110 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java +Starting at line 117 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java + + mockMvc.perform(put("/api/surveys/" + survey.getId()) + .content(TestUtil.convertObjectToJsonBytes(survey)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 5 line (32 tokens) duplication in the following files: +Starting at line 102 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyShadowCopyServiceTest.java +Starting at line 120 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyShadowCopyServiceTest.java + + Survey shadow = createShadow(master, release.getVersion()); + surveyRepository.saveAll(Arrays.asList(master, shadow)); + + shadowCopyService.createShadowCopies(project.getId(), project.getRelease(), + "1.0.0"); +===================================================================== +Found a 7 line (32 tokens) duplication in the following files: +Starting at line 155 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java +Starting at line 227 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java +Starting at line 253 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java + + public void testRequestPasswordReset() throws Exception { + // Arrange + User user = UnitTestUserManagementUtils.getDefaultUser(); + user.setPassword("sdkgfsdkkgfsdglkfglsdjkagfjklsdgfhklsdglkfglksdgslkfgsdklj12"); + user.setActivationKey("testActivateTrue"); + user.setActivated(true); + user = this.userRepository.save(user); +===================================================================== +Found a 2 line (32 tokens) duplication in the following files: +Starting at line 323 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java +Starting at line 343 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java +Starting at line 361 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java +Starting at line 385 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java +Starting at line 417 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java +Starting at line 446 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java + + restMvc.perform(post("/api/register").contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(u))).andExpect(status().isCreated()); +===================================================================== +Found a 5 line (32 tokens) duplication in the following files: +Starting at line 460 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 495 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 857 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + variable.setScaleLevel(I18nString.builder().de("InvalidValue").en("InvalidValue").build()); + + // create the variable with a survey but without a project + mockMvc.perform(put(API_VARIABLES_URI + "/" + variable.getId()) + .content(TestUtil.convertObjectToJsonBytes(variable)) +===================================================================== +Found a 5 line (32 tokens) duplication in the following files: +Starting at line 99 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/VariableShadowCopyServiceTest.java +Starting at line 117 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/VariableShadowCopyServiceTest.java + + Variable shadow = createShadow(master, release.getVersion()); + variableRepository.saveAll(Arrays.asList(master, shadow)); + + shadowCopyService.createShadowCopies(project.getId(), project.getRelease(), + "1.0.0"); +===================================================================== +Found a 1 line (32 tokens) duplication in the following files: +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/domain/QConcept.java +Starting at line 56 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSubDocument.java +Starting at line 49 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 104 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 49 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSubDocument.java + + public final ListPath authors = this.createList("authors", eu.dzhw.fdz.metadatamanagement.common.domain.Person.class, eu.dzhw.fdz.metadatamanagement.common.domain.QPerson.class, PathInits.DIRECT2); +===================================================================== +Found a 1 line (32 tokens) duplication in the following files: +Starting at line 36 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/domain/QConcept.java +Starting at line 47 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QConceptSearchDocument.java +Starting at line 57 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 58 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString description = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("description")); +===================================================================== +Found a 1 line (32 tokens) duplication in the following files: +Starting at line 26 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/QDataSet.java +Starting at line 26 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/QInstrument.java +Starting at line 29 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/domain/QQuestion.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/domain/QRelatedPublication.java +Starting at line 32 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationSearchDocument.java +Starting at line 32 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java +Starting at line 25 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QSurvey.java +Starting at line 28 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/QVariable.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString annotations = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("annotations")); +===================================================================== +Found a 1 line (32 tokens) duplication in the following files: +Starting at line 46 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 61 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 70 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 87 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 95 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 116 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 125 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java +Starting at line 39 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSubDocument.java +Starting at line 53 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSubDocument.java +Starting at line 69 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QRelatedPublicationSearchDocument.java + + public final ListPath institutions = this.createList("institutions", eu.dzhw.fdz.metadatamanagement.common.domain.I18nString.class, eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString.class, PathInits.DIRECT2); +===================================================================== +Found a 1 line (32 tokens) duplication in the following files: +Starting at line 64 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 120 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString studySeries = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("studySeries")); +===================================================================== +Found a 1 line (32 tokens) duplication in the following files: +Starting at line 70 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/domain/QDataPackage.java +Starting at line 129 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageSearchDocument.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString surveyDesign = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("surveyDesign")); +===================================================================== +Found a 1 line (32 tokens) duplication in the following files: +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/ordermanagement/domain/QProduct.java +Starting at line 27 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/ordermanagement/domain/QProduct.java + + public final SetPath> dataFormats = this.>createSet("dataFormats", eu.dzhw.fdz.metadatamanagement.datasetmanagement.domain.DataFormat.class, EnumPath.class, PathInits.DIRECT2); +===================================================================== +Found a 1 line (32 tokens) duplication in the following files: +Starting at line 51 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/domain/QQuestion.java +Starting at line 73 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString instruction = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("instruction")); +===================================================================== +Found a 1 line (32 tokens) duplication in the following files: +Starting at line 58 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/domain/QQuestion.java +Starting at line 85 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString introduction = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("introduction")); +===================================================================== +Found a 1 line (32 tokens) duplication in the following files: +Starting at line 71 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/domain/QQuestion.java +Starting at line 113 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString questionText = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(forProperty("questionText")); +===================================================================== +Found a 1 line (32 tokens) duplication in the following files: +Starting at line 111 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java +Starting at line 66 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QSurvey.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString sample = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(_super.sample); +===================================================================== +Found a 1 line (32 tokens) duplication in the following files: +Starting at line 64 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java +Starting at line 38 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/domain/QSurvey.java +Starting at line 45 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/QVariable.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString dataType = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(_super.dataType); +===================================================================== +Found a 1 line (32 tokens) duplication in the following files: +Starting at line 138 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java +Starting at line 87 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/QVariable.java + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString scaleLevel = new eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString(_super.scaleLevel); +===================================================================== +Found a 3 line (31 tokens) duplication in the following files: +Starting at line 61 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/rest/GenericDomainObjectResourceController.java +Starting at line 43 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/rest/I18nResourceController.java +Starting at line 57 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/rest/I18nResourceController.java +Starting at line 27 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataFormatsResource.java +Starting at line 106 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/ordermanagement/rest/OrderResource.java +Starting at line 35 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveySampleTypeResource.java +Starting at line 34 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/UnitValueResource.java + + return ResponseEntity.ok() + .cacheControl(CacheControl.maxAge(0, TimeUnit.DAYS).mustRevalidate().cachePublic()) + .eTag(domainObject.getVersion().toString()).lastModified(domainObject +===================================================================== +Found a 5 line (31 tokens) duplication in the following files: +Starting at line 132 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/service/TaskManagementService.java +Starting at line 140 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/service/TaskManagementService.java + + private void handleDataSetReportError(TaskErrorNotification errorNotification, User onBehalfUser, + String projectManagementEmailSender) { + List admins = + userRepository.findAllByAuthoritiesContaining(new Authority(AuthoritiesConstants.ADMIN)); + mailService.sendDataSetReportErrorMail(onBehalfUser, admins, errorNotification, +===================================================================== +Found a 7 line (31 tokens) duplication in the following files: +Starting at line 207 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/service/TaskManagementService.java +Starting at line 214 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/service/TaskManagementService.java + + crudHelper.delete(domainObject); + } + + @Override + @Secured(value = {AuthoritiesConstants.PUBLISHER, AuthoritiesConstants.ADMIN, + AuthoritiesConstants.DATA_PROVIDER, AuthoritiesConstants.TASK_USER}) + public Task save(Task domainObject) { +===================================================================== +Found a 3 line (31 tokens) duplication in the following files: +Starting at line 31 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DaraOaiPmhClient.java +Starting at line 26 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataCiteClient.java +Starting at line 78 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/rest/SearchResource.java + + restTemplate = new RestTemplate(new HttpComponentsClientHttpRequestFactory()); + restTemplate.getMessageConverters().add(0, + new StringHttpMessageConverter(Charset.forName("UTF-8"))); +===================================================================== +Found a 4 line (31 tokens) duplication in the following files: +Starting at line 203 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentService.java +Starting at line 212 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentService.java + + case "de": + metadata = DataPackageAttachmentMetadata.builder().dataPackageId(dataPackageId) + .dataAcquisitionProjectId(dataPackage.getDataAcquisitionProjectId()) + .fileName(dataPackage.getDataAcquisitionProjectId() + "_Overview_de.pdf") +===================================================================== +Found a 3 line (31 tokens) duplication in the following files: +Starting at line 54 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/helper/DataPackageAttachmentShadowCopyDataSource.java +Starting at line 46 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/helper/QuestionShadowCopyDataSource.java +Starting at line 49 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/helper/VariableShadowCopyDataSource.java + + source.getDataAcquisitionProjectId() + "-" + release.getVersion()); + copy.setDataPackageId(source.getDataPackageId() + "-" + release.getVersion()); + copy.generateId(); +===================================================================== +Found a 3 line (31 tokens) duplication in the following files: +Starting at line 54 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/helper/InstrumentAttachmentShadowCopyDataSource.java +Starting at line 47 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/helper/QuestionShadowCopyDataSource.java + + source.getDataAcquisitionProjectId() + "-" + release.getVersion()); + copy.setInstrumentId(source.getInstrumentId() + "-" + release.getVersion()); + copy.generateId(); +===================================================================== +Found a 9 line (31 tokens) duplication in the following files: +Starting at line 28 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/domain/DaraUpdateQueueItem.java +Starting at line 33 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/domain/ElasticsearchUpdateQueueItem.java + + @CompoundIndex(def = "{updateStartedAt: 1, updateStartedBy: 1, createdDate: 1}") + }) +@EqualsAndHashCode(callSuper = false, of = "id") +@ToString(callSuper = true) +@NoArgsConstructor +@Data +@AllArgsConstructor +@Builder +public class DaraUpdateQueueItem extends AbstractRdcDomainObject { +===================================================================== +Found a 4 line (31 tokens) duplication in the following files: +Starting at line 39 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResource.java +Starting at line 146 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/rest/SearchResource.java + + @RequestMapping(value = "/data-acquisition-projects/{id}/post-validate", + method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) + @Secured(value = {AuthoritiesConstants.PUBLISHER, AuthoritiesConstants.DATA_PROVIDER}) + public ResponseEntity postValidate(@PathVariable String id, +===================================================================== +Found a 8 line (31 tokens) duplication in the following files: +Starting at line 62 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 47 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentVersionsResourceTest.java +Starting at line 69 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 54 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java +Starting at line 61 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAccessWaysResourceControllerTest.java +Starting at line 73 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 47 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentVersionsResourceTest.java +Starting at line 59 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 52 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DeleteAllDataPackagesResourceControllerTest.java +Starting at line 51 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/StudySeriesesResourceControllerTest.java +Starting at line 52 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/AvailableDataSetNumbersResourceControllerTest.java +Starting at line 73 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 47 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentVersionsResourceTest.java +Starting at line 76 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 60 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java +Starting at line 53 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DeleteAllDateSetsResourceControllerTest.java +Starting at line 47 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/AvailableInstrumentNumbersResourceControllerTest.java +Starting at line 56 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/DeleteAllInstrumentsResourceControllerTest.java +Starting at line 58 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 47 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentVersionsResourceTest.java +Starting at line 66 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 59 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 69 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DaraServiceTest.java +Starting at line 44 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectAttachmentsResourceControllerTest.java +Starting at line 46 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectLastReleaseResourceTest.java +Starting at line 46 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectReleasesResourceTest.java +Starting at line 71 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 62 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 50 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/DeleteAllQuestionsResourceControllerTest.java +Starting at line 64 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionImageResourceTest.java +Starting at line 71 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 73 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 52 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/rest/SearchResourceTest.java +Starting at line 47 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/AvailableSurveyNumbersResourceControllerTest.java +Starting at line 54 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/DeleteAllSurveysResourceControllerTest.java +Starting at line 72 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 47 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentVersionsResourceTest.java +Starting at line 70 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 71 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResponseRateImageResourceTest.java +Starting at line 59 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java +Starting at line 53 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/DeleteAllVariablesResourceControllerTest.java +Starting at line 87 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(wac) + .build(); + } + + @After + public void cleanUp() { +===================================================================== +Found a 4 line (31 tokens) duplication in the following files: +Starting at line 92 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 105 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 142 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java + + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); + + // read the concept under the new url + mockMvc.perform(get(API_CONCEPT_URI + "/" + concept.getId())).andExpect(status().isOk()); +===================================================================== +Found a 6 line (31 tokens) duplication in the following files: +Starting at line 95 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 108 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 124 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 110 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java + + mockMvc.perform(get(API_CONCEPT_URI + "/" + concept.getId())).andExpect(status().isOk()); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER) + public void testCreateConceptWithPost() throws IOException, Exception { +===================================================================== +Found a 6 line (31 tokens) duplication in the following files: +Starting at line 166 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 233 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 284 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 372 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + mockMvc.perform(get(API_CONCEPT_URI + "/" + concept.getId())).andExpect(status().isNotFound()); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER) + public void testDeleteUsedConceptByQuestion() throws Exception { +===================================================================== +Found a 4 line (31 tokens) duplication in the following files: +Starting at line 178 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 198 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java + + .content(TestUtil.convertObjectToJsonBytes(question)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().is2xxSuccessful()); + + mockMvc.perform(delete(API_CONCEPT_URI + "/" + conceptInQuestion.getId())) +===================================================================== +Found a 5 line (31 tokens) duplication in the following files: +Starting at line 98 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 121 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 206 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 326 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java + + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); + + // read the dataPackage under the new url + mockMvc.perform(get(API_DATAPACKAGE_URI + "/" + dataPackage.getId())) + .andExpect(status().isOk()); +===================================================================== +Found a 4 line (31 tokens) duplication in the following files: +Starting at line 289 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 350 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 324 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 498 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 372 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 411 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 905 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + mockMvc.perform(delete(API_DATAPACKAGE_URI + "/" + dataPackage.getId())) + .andExpect(status().isBadRequest()).andExpect(jsonPath("$.errors[0].message", + containsString("global.error.shadow-delete-not-allowed"))); + } +===================================================================== +Found a 3 line (31 tokens) duplication in the following files: +Starting at line 76 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/StudySeriesesResourceControllerTest.java +Starting at line 69 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/AvailableDataSetNumbersResourceControllerTest.java +Starting at line 63 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/AvailableInstrumentNumbersResourceControllerTest.java +Starting at line 63 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/AvailableSurveyNumbersResourceControllerTest.java + + .perform(get("/api/study-serieses")).andExpect(status().isOk()) + .andExpect(jsonPath("$.length()", is(1))) + .andExpect(jsonPath("$.[0].de", is(dataPackage.getStudySeries().getDe()))); +===================================================================== +Found a 7 line (31 tokens) duplication in the following files: +Starting at line 145 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageShadowCopyServiceTest.java +Starting at line 153 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetShadowCopyServiceTest.java +Starting at line 145 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentShadowCopyServiceTest.java +Starting at line 154 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionShadowCopyServiceTest.java +Starting at line 149 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyShadowCopyServiceTest.java +Starting at line 146 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/VariableShadowCopyServiceTest.java + + shadow = dataPackageRepository.save(shadow); + release.setVersion("1.0.1"); + + shadowCopyService.createShadowCopies(project.getId(), project.getRelease(), + "1.0.0"); + + Optional persistedShadow = dataPackageRepository.findById(shadow.getId()); +===================================================================== +Found a 3 line (31 tokens) duplication in the following files: +Starting at line 158 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageShadowCopyServiceTest.java +Starting at line 159 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/VariableShadowCopyServiceTest.java + + DataPackage shadow = new DataPackage(master); + shadow.setId(master.getId() + "-" + version); + shadow.setDataAcquisitionProjectId(master.getDataAcquisitionProjectId() + "-" + version); +===================================================================== +Found a 4 line (31 tokens) duplication in the following files: +Starting at line 75 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/AvailableDataSetNumbersResourceControllerTest.java +Starting at line 69 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/AvailableSurveyNumbersResourceControllerTest.java +Starting at line 86 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 111 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 131 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 146 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 184 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 290 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 316 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 354 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + public void testAvailableNumbersIfThereIsOneDataSet() throws Exception { + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + rdcProjectRepository.save(project); + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); +===================================================================== +Found a 6 line (31 tokens) duplication in the following files: +Starting at line 324 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 346 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 366 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java + + public void testUpdateAttachmentOfShadowDataSet() throws Exception { + String dataSetId = "dat-issue1991-ds1$-1.0.0"; + DataSetAttachmentMetadata metadata = UnitTestCreateDomainObjectUtils + .buildDataSetAttachmentMetadata("issue1991", 1); + metadata.setDataSetId(dataSetId); + metadata.generateId(); +===================================================================== +Found a 6 line (31 tokens) duplication in the following files: +Starting at line 157 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 248 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 357 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java + + public void testCreateDataSetWithSurveyButWithoutProject() throws Exception { + // Arrange + DataAcquisitionProject project = UnitTestCreateDomainObjectUtils.buildDataAcquisitionProject(); + this.dataAcquisitionProjectRepository.save(project); + + Survey survey = UnitTestCreateDomainObjectUtils.buildSurvey(project.getId()); +===================================================================== +Found a 5 line (31 tokens) duplication in the following files: +Starting at line 169 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 273 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java + + .andExpect(status().is2xxSuccessful()); + + // read the updated instrument and check the version + mockMvc.perform(get(API_INSTRUMENTS_URI + "/" + instrument.getId())) + .andExpect(status().isOk()) +===================================================================== +Found a 3 line (31 tokens) duplication in the following files: +Starting at line 108 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/ordermanagement/rest/OrderResourceTest.java +Starting at line 130 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/ordermanagement/rest/OrderResourceTest.java + + mockMvc.perform(post("/api/orders").contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(order))).andExpect(status().isBadRequest()); + } +===================================================================== +Found a 7 line (31 tokens) duplication in the following files: +Starting at line 371 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 460 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java + + .content(TestUtil.convertObjectToJsonBytes(project))) + .andExpect(status().isBadRequest()); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER, username = PUBLISHER_USERNAME) + public void testUpdateRequiredObjectTypes() throws Exception { +===================================================================== +Found a 7 line (31 tokens) duplication in the following files: +Starting at line 410 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 306 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java + + .content(TestUtil.convertObjectToJsonBytes(project)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.DATA_PROVIDER, username = DATA_PROVIDER_USERNAME) +===================================================================== +Found a 4 line (31 tokens) duplication in the following files: +Starting at line 157 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 192 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java + + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); + + // assert that the question exists + mockMvc.perform(get(API_QUESTIONS_URI + "/" + question.getId())).andExpect(status().isOk()); +===================================================================== +Found a 5 line (31 tokens) duplication in the following files: +Starting at line 163 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 327 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java + + mockMvc.perform(delete(API_QUESTIONS_URI + "/" + question.getId())).andExpect(status().isNoContent()); + + // assert that the question does not exist anymore + mockMvc.perform(get(API_QUESTIONS_URI + "/" + question.getId())) + .andExpect(status().isNotFound()); +===================================================================== +Found a 6 line (31 tokens) duplication in the following files: +Starting at line 302 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 324 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 344 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + public void testUpdateAttachmentOfShadowCopySurvey() throws Exception { + String surveyId = "sur-issue1991-sy1$-1.0.0"; + SurveyAttachmentMetadata metadata = UnitTestCreateDomainObjectUtils + .buildSurveyAttachmentMetadata("issue1991", 1); + metadata.setSurveyId(surveyId); + metadata.generateId(); +===================================================================== +Found a 4 line (31 tokens) duplication in the following files: +Starting at line 139 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 154 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 177 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 383 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + mockMvc.perform(put(API_SURVEYS_URI + "/" + survey.getId()) + .content(TestUtil.convertObjectToJsonBytes(survey)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) + .andReturn(); +===================================================================== +Found a 5 line (31 tokens) duplication in the following files: +Starting at line 71 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyResponseRateImageShadowCopyServiceTest.java +Starting at line 106 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyResponseRateImageShadowCopyServiceTest.java +Starting at line 134 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyResponseRateImageShadowCopyServiceTest.java + + createTestFileForSurveyRateImage(master); + DataAcquisitionProject dataAcquisitionProject = createDataAcquisitionProject(); + release.setVersion("1.0.1"); + shadowCopyService.createShadowCopies(dataAcquisitionProject.getId(), + dataAcquisitionProject.getRelease(), "1.0.0"); +===================================================================== +Found a 8 line (31 tokens) duplication in the following files: +Starting at line 167 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java +Starting at line 246 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java + + .content(user.getEmail())).andExpect(status().isOk()); + + this.userRepository.deleteById(user.getId()); + } + + + @Test + public void testSaveAccount() throws Exception { +===================================================================== +Found a 3 line (30 tokens) duplication in the following files: +Starting at line 102 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/service/AbstractAttachmentShadowCopyDataSource.java +Starting at line 144 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/service/AbstractAttachmentShadowCopyDataSource.java +Starting at line 169 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/service/AbstractAttachmentShadowCopyDataSource.java + + new Query(GridFsCriteria.whereMetaData("dataAcquisitionProjectId").is(oldProjectVersion) + .andOperator(GridFsCriteria.whereFilename().regex(getMasterFileNamePattern()), + GridFsCriteria.whereMetaData("shadow").is(true))); +===================================================================== +Found a 6 line (30 tokens) duplication in the following files: +Starting at line 199 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/common/service/TaskManagementService.java +Starting at line 235 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/service/DataAcquisitionProjectManagementService.java + + public Optional read(String id) { + return crudHelper.read(id); + } + + @Override + @Secured(value = {AuthoritiesConstants.PUBLISHER, AuthoritiesConstants.ADMIN, +===================================================================== +Found a 8 line (30 tokens) duplication in the following files: +Starting at line 29 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/domain/ConceptAttachmentMetadata.java +Starting at line 31 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/domain/DataSetAttachmentMetadata.java +Starting at line 31 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/domain/InstrumentAttachmentMetadata.java + +@Entity +@EqualsAndHashCode(callSuper = false, of = "id") +@ToString(callSuper = true) +@NoArgsConstructor +@Data +@AllArgsConstructor +@Builder +public class ConceptAttachmentMetadata extends AbstractRdcDomainObject { +===================================================================== +Found a 4 line (30 tokens) duplication in the following files: +Starting at line 72 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptAttachmentService.java +Starting at line 110 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptAttachmentService.java +Starting at line 90 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentService.java +Starting at line 151 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentService.java +Starting at line 93 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentService.java +Starting at line 162 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetAttachmentService.java +Starting at line 86 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentService.java +Starting at line 155 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentAttachmentService.java +Starting at line 73 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentService.java + + public void deleteAllByConceptId(String conceptId) { + String currentUser = SecurityUtils.getCurrentUserLogin(); + Query query = new Query(GridFsCriteria.whereFilename() + .regex("^" + Pattern.quote( +===================================================================== +Found a 12 line (30 tokens) duplication in the following files: +Starting at line 117 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptAttachmentService.java +Starting at line 148 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyAttachmentService.java + + ConceptAttachmentMetadata.class, file.getMetadata()); + javers.commitShallowDelete(currentUser, metadata); + }); + this.operations.delete(query); + } + + /** + * Delete the attachment and its metadata from gridfs. + * @param conceptId The id of the {@link Concept}. + * @param filename The filename of the attachment. + */ + public void deleteByConceptIdAndFilename(String conceptId, String filename) { +===================================================================== +Found a 3 line (30 tokens) duplication in the following files: +Starting at line 93 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptManagementService.java +Starting at line 100 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptManagementService.java +Starting at line 145 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptManagementService.java +Starting at line 187 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptManagementService.java +Starting at line 211 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/service/ConceptManagementService.java +Starting at line 499 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/service/ElasticsearchUpdateQueueService.java + + .map(instrument -> instrument.getConceptIds() != null ? instrument.getConceptIds() + : new ArrayList()) + .flatMap(List::stream).collect(Collectors.toSet())); +===================================================================== +Found a 4 line (30 tokens) duplication in the following files: +Starting at line 94 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageOverviewResource.java +Starting at line 91 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetReportResource.java + + @PostMapping(value = "/data-packages/{dataPackageId}/overview/fill-template") + @Secured(value = {AuthoritiesConstants.TASK_USER}) + public ResponseEntity fillTemplate(@RequestParam("file") MultipartFile templateZip, + @PathVariable("dataPackageId") String dataPackageId, @RequestParam("version") String version) +===================================================================== +Found a 3 line (30 tokens) duplication in the following files: +Starting at line 55 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageListService.java +Starting at line 99 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageListService.java + + .query(QueryBuilders.boolQuery().filter(QueryBuilders.termQuery("shadow", true)) + .mustNot(QueryBuilders.existsQuery("successorId"))) + .from(page * size).size(size).sort("title.de", SortOrder.ASC); +===================================================================== +Found a 6 line (30 tokens) duplication in the following files: +Starting at line 113 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageOverviewService.java +Starting at line 167 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetReportService.java + + dataForTemplate.put("version", version); + dataForTemplate.put("removeMarkdown", markdownHelper.createRemoveMarkdownMethod()); + dataForTemplate.put("displayAccessWay", AccessWays.createDisplayAccessWayMethod()); + + try { + String mainFilledStr = +===================================================================== +Found a 7 line (30 tokens) duplication in the following files: +Starting at line 41 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/repository/InstrumentRepository.java +Starting at line 34 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/repository/VariableRepository.java + + String dataAcquisitionProjectId); + + @RestResource(exported = false) + Stream streamIdsBySurveyIdsContaining(String surveyId); + + @RestResource(exported = false) + Stream streamIdsByDataPackageId(String dataPackageId); +===================================================================== +Found a 7 line (30 tokens) duplication in the following files: +Starting at line 61 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentChangesProvider.java +Starting at line 40 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionChangesProvider.java + + List oldConceptIds = oldInstrument.getConceptIds(); + + if (oldConceptIds == null || oldConceptIds.isEmpty()) { + return Collections.emptySet(); + } + + List newConceptIds = newInstrument.getConceptIds(); +===================================================================== +Found a 4 line (30 tokens) duplication in the following files: +Starting at line 44 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/repository/DaraUpdateQueueItemRepositoryImpl.java +Starting at line 37 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/repository/ShadowCopyQueueRepositoryCustomImpl.java +Starting at line 38 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/repository/ElasticsearchUpdateQueueItemRepositoryImpl.java +Starting at line 60 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/repository/ElasticsearchUpdateQueueItemRepositoryImpl.java + + Query query = new Query(getUnlockedOrExpiredCriteria()).limit(BULK_SIZE); + Update update = new Update() + .set("updateStartedAt", updateStartedAt).set("updateStartedBy", updateStartedBy); + mongoOperations.updateMulti(query, update, DaraUpdateQueueItem.class); +===================================================================== +Found a 4 line (30 tokens) duplication in the following files: +Starting at line 73 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/usermanagement/security/SecurityUtils.java +Starting at line 86 of /home/reitmann/data/metadatamanagement/src/main/java/eu/dzhw/fdz/metadatamanagement/usermanagement/security/SecurityUtils.java + + public static CustomUserDetails getCurrentUser() { + SecurityContext securityContext = SecurityContextHolder.getContext(); + Authentication authentication = securityContext.getAuthentication(); + if (authentication != null && authentication.getPrincipal() instanceof CustomUserDetails) { +===================================================================== +Found a 7 line (30 tokens) duplication in the following files: +Starting at line 66 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/domain/I18nStringTest.java +Starting at line 75 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/domain/PeriodTest.java +Starting at line 62 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/domain/AuthorityTest.java +Starting at line 51 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/domain/UserTests.java +Starting at line 36 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/domain/VariableTest.java + + boolean checkSameButDifferentEnd = i18nString1.equals(i18nString2); + + // Assert + assertThat(checkNull, is(false)); + assertThat(checkClass, is(false)); + assertThat(checkSame, is(true)); + assertThat(checkSameButDifferentNoEnNoDe, is(true)); +===================================================================== +Found a 3 line (30 tokens) duplication in the following files: +Starting at line 119 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/unittesthelper/util/UnitTestCreateDomainObjectUtils.java +Starting at line 143 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/unittesthelper/util/UnitTestCreateDomainObjectUtils.java +Starting at line 210 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/unittesthelper/util/UnitTestCreateDomainObjectUtils.java +Starting at line 318 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/unittesthelper/util/UnitTestCreateDomainObjectUtils.java +Starting at line 415 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/unittesthelper/util/UnitTestCreateDomainObjectUtils.java + + .title(I18nString.builder().de("Titel De").en("Title En").build()) + .annotations(I18nString.builder().de("De Anmerkungen").en("En Annotations").build()) + .tags(tags).surveyDesign(SurveyDesigns.PANEL) +===================================================================== +Found a 3 line (30 tokens) duplication in the following files: +Starting at line 451 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/unittesthelper/util/UnitTestCreateDomainObjectUtils.java +Starting at line 457 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/common/unittesthelper/util/UnitTestCreateDomainObjectUtils.java + + .dataPackageId(UnitTestCreateValidIds.buildDataPackageId(projectId)).fileName("filename.txt") + .description(new I18nString("Beschreibung", "Description")).title("Title").language("de") + .type(DataPackageAttachmentTypes.METHOD_REPORT).indexInDataPackage(1).build(); +===================================================================== +Found a 6 line (30 tokens) duplication in the following files: +Starting at line 79 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 109 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 141 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 173 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 213 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 233 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 59 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentVersionsResourceTest.java + + public void testUploadValidAttachment() throws Exception { + + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); + ConceptAttachmentMetadata conceptAttachmentMetadata = UnitTestCreateDomainObjectUtils + .buildConceptAttachmentMetadata("con-conceptid$"); +===================================================================== +Found a 2 line (30 tokens) duplication in the following files: +Starting at line 124 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 156 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 200 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 200 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 147 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 182 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + .perform(get("/api/concepts/" + conceptAttachmentMetadata.getConceptId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(1))); +===================================================================== +Found a 2 line (30 tokens) duplication in the following files: +Starting at line 188 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 134 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 167 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 135 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 168 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 115 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 191 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 128 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 155 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + .perform(get("/api/concepts/" + conceptAttachmentMetadata.getConceptId() + "/attachments")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(1))); +===================================================================== +Found a 5 line (30 tokens) duplication in the following files: +Starting at line 223 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 244 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 242 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 262 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 313 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 237 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 258 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 315 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 220 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 240 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 109 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionImageResourceTest.java +Starting at line 217 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 238 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 293 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 198 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResponseRateImageResourceTest.java + + mockMvc.perform(MockMvcRequestBuilders.multipart("/api/concepts/attachments") + .file(attachment) + .file(metadata)) + .andExpect(status().isBadRequest()) + .andExpect(jsonPath("$.errors[0].message", +===================================================================== +Found a 3 line (30 tokens) duplication in the following files: +Starting at line 259 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 104 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 130 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 92 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java + + mockMvc.perform(put("/api/concepts/" + concept.getId()) + .content(TestUtil.convertObjectToJsonBytes(concept)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 4 line (30 tokens) duplication in the following files: +Starting at line 282 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptAttachmentResourceTest.java +Starting at line 295 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 297 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 276 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 276 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java + + get("/api/concepts/" + conceptAttachmentMetadata.getConceptId() + "/attachments")) + .andExpect(status().isOk()) + .andExpect(content().json("[]")); + } +===================================================================== +Found a 4 line (30 tokens) duplication in the following files: +Starting at line 92 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 105 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java +Starting at line 214 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptResourceControllerTest.java + + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); + + // read the concept under the new url + mockMvc.perform(get(API_CONCEPT_URI + "/" + concept.getId())).andExpect(status().isOk()); +===================================================================== +Found a 2 line (30 tokens) duplication in the following files: +Starting at line 77 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java +Starting at line 126 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 135 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java +Starting at line 130 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 122 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java + + mockMvc.perform(get(API_CONCEPT_URI + "/" + concept.getId() + "/versions")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(equalTo(1)))) +===================================================================== +Found a 3 line (30 tokens) duplication in the following files: +Starting at line 78 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java +Starting at line 112 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java +Starting at line 134 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java + + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(equalTo(1)))) + .andExpect(jsonPath("$[0].id", is(concept.getId()))) + .andExpect(jsonPath("$[0].title.de", is(concept.getTitle().getDe()))) +===================================================================== +Found a 2 line (30 tokens) duplication in the following files: +Starting at line 111 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java +Starting at line 87 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 92 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 86 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 87 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java + + mockMvc.perform(get(API_CONCEPT_URI + "/" + concept.getId() + "/versions")) + .andExpect(status().isOk()).andExpect(jsonPath("$.length()", is(equalTo(3)))) +===================================================================== +Found a 4 line (30 tokens) duplication in the following files: +Starting at line 151 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/conceptmanagement/rest/ConceptVersionsResourceTest.java +Starting at line 173 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 151 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java +Starting at line 146 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 138 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java + + mockMvc.perform(get(API_CONCEPT_URI + "/spaß/versions")).andExpect(status().isOk()) + .andExpect(jsonPath("$.length()", is(0))); + } +} +===================================================================== +Found a 3 line (30 tokens) duplication in the following files: +Starting at line 274 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 121 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 143 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 173 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 199 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 119 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 193 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 107 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java + + mockMvc.perform(put("/api/data-packages/" + dataPackage.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataPackage)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); +===================================================================== +Found a 4 line (30 tokens) duplication in the following files: +Starting at line 337 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 140 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 261 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 276 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 338 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 321 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 336 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 296 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 310 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 471 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 485 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 345 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 359 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 153 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 173 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 193 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 316 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 384 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 398 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 310 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 339 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 360 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 389 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 421 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 874 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 890 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + .content(TestUtil.convertObjectToJsonBytes(metadata)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()).andExpect(jsonPath("$.errors[0].message", + containsString("global.error.shadow-save-not-allowed"))); +===================================================================== +Found a 6 line (30 tokens) duplication in the following files: +Starting at line 380 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageAttachmentResourceTest.java +Starting at line 379 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 324 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 498 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 372 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 357 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 411 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 905 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + "/api/data-packages/" + dataPackageId + "/attachments/" + metadata.getFileName())) + .andExpect(status().isBadRequest()).andExpect(jsonPath("$.errors[0].message", + containsString("global.error.shadow-delete-not-allowed"))); + } + +} +===================================================================== +Found a 17 line (30 tokens) duplication in the following files: +Starting at line 46 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 50 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 39 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 31 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/StudySeriesesResourceControllerTest.java + + @Autowired + private WebApplicationContext wac; + + @Autowired + private DataAcquisitionProjectRepository dataAcquisitionProjectRepository; + + @Autowired + private DataPackageRepository dataPackageRepository; + + @Autowired + private ElasticsearchUpdateQueueItemRepository elasticsearchUpdateQueueItemRepository; + + @Autowired + private ElasticsearchAdminService elasticsearchAdminService; + + @Autowired + private JaversService javersService; +===================================================================== +Found a 3 line (30 tokens) duplication in the following files: +Starting at line 126 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java +Starting at line 157 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackagePublicListResourceControllerTest.java + + UnitTestUserManagementUtils.logout(); + mockMvc.perform(get(API_DATAPACKAGE_URI)).andExpect(status().isOk()) + .andExpect(jsonPath("$.content.length()", is(0))); +===================================================================== +Found a 5 line (30 tokens) duplication in the following files: +Starting at line 98 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 121 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java +Starting at line 302 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageResourceControllerTest.java + + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); + + // read the dataPackage under the new url + mockMvc.perform(get(API_DATAPACKAGE_URI + "/" + dataPackage.getId())) + .andExpect(status().isOk()); +===================================================================== +Found a 3 line (30 tokens) duplication in the following files: +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 128 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java +Starting at line 154 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageVersionsResourceTest.java + + .andExpect(jsonPath("$.length()", is(equalTo(1)))) + .andExpect(jsonPath("$[0].id", is(dataPackage.getId()))) + .andExpect(jsonPath("$[0].title.de", is(dataPackage.getTitle().getDe()))) +===================================================================== +Found a 4 line (30 tokens) duplication in the following files: +Starting at line 99 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageShadowCopyServiceTest.java +Starting at line 125 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetShadowCopyServiceTest.java +Starting at line 118 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentShadowCopyServiceTest.java +Starting at line 126 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionShadowCopyServiceTest.java +Starting at line 122 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyShadowCopyServiceTest.java +Starting at line 119 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/VariableShadowCopyServiceTest.java + + dataPackageRepository.saveAll(Arrays.asList(master, shadow)); + + shadowCopyService.createShadowCopies(project.getId(), project.getRelease(), + "1.0.0"); +===================================================================== +Found a 4 line (30 tokens) duplication in the following files: +Starting at line 118 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageShadowCopyServiceTest.java +Starting at line 105 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetShadowCopyServiceTest.java +Starting at line 99 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/service/InstrumentShadowCopyServiceTest.java +Starting at line 106 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/service/QuestionShadowCopyServiceTest.java +Starting at line 103 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/service/SurveyShadowCopyServiceTest.java +Starting at line 100 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/service/VariableShadowCopyServiceTest.java + + dataPackageRepository.saveAll(Arrays.asList(master, shadow)); + + shadowCopyService.createShadowCopies(project.getId(), project.getRelease(), + "1.0.0"); +===================================================================== +Found a 9 line (30 tokens) duplication in the following files: +Starting at line 60 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/AvailableDataSetNumbersResourceControllerTest.java +Starting at line 54 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/AvailableSurveyNumbersResourceControllerTest.java + + surveyRepo.deleteAll(); + rdcProjectRepository.deleteAll(); + javersService.deleteAll(); + elasticsearchUpdateQueueItemRepository.deleteAll(); + elasticsearchAdminService.recreateAllIndices(); + } + + @Test + public void testAvailableNumbersIfThereAreNoDataSets() throws Exception { +===================================================================== +Found a 6 line (30 tokens) duplication in the following files: +Starting at line 90 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 119 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 152 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 185 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 227 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 247 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 304 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 59 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentVersionsResourceTest.java + + public void testUploadValidAttachment() throws Exception { + + MockMultipartFile attachment = + new MockMultipartFile("file", "filename.txt", "text/plain", "some text".getBytes()); + DataSetAttachmentMetadata dataSetAttachmentMetadata = UnitTestCreateDomainObjectUtils + .buildDataSetAttachmentMetadata("projectid", 1); +===================================================================== +Found a 3 line (30 tokens) duplication in the following files: +Starting at line 274 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetAttachmentResourceTest.java +Starting at line 140 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 288 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 111 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java + + mockMvc.perform(put("/api/data-sets/" + dataSet.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataSet)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 8 line (30 tokens) duplication in the following files: +Starting at line 86 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 81 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 82 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java + + this.dataSetRepository.deleteAll(); + this.elasticsearchUpdateQueueService.clearQueue(); + this.elasticsearchAdminService.recreateAllIndices(); + this.javersService.deleteAll(); + } + + @Test + public void testCreateDataSet() throws Exception { +===================================================================== +Found a 3 line (30 tokens) duplication in the following files: +Starting at line 170 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 188 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 204 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 320 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java + + mockMvc.perform(put(API_DATASETS_URI + "/" + dataSet.getId()) + .content(TestUtil.convertObjectToJsonBytes(dataSet)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()); +===================================================================== +Found a 3 line (30 tokens) duplication in the following files: +Starting at line 316 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 329 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java +Starting at line 344 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetResourceControllerTest.java + + public void testCreateShadowCopyDataSet() throws Exception { + DataSet dataSet = UnitTestCreateDomainObjectUtils.buildDataSet("issue1991", "test", 1); + dataSet.setId(dataSet.getId() + "-1.0.0"); +===================================================================== +Found a 3 line (30 tokens) duplication in the following files: +Starting at line 94 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java +Starting at line 137 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetVersionsResourceTest.java + + .andExpect(jsonPath("$.length()", is(equalTo(1)))) + .andExpect(jsonPath("$[0].id", is(dataSet.getId()))) + .andExpect(jsonPath("$[0].description.de", is(dataSet.getDescription().getDe()))); +===================================================================== +Found a 3 line (30 tokens) duplication in the following files: +Starting at line 253 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentAttachmentResourceTest.java +Starting at line 128 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 156 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 196 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 271 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 83 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 106 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java + + mockMvc.perform(put("/api/instruments/" + instrument.getId()) + .content(TestUtil.convertObjectToJsonBytes(instrument)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); +===================================================================== +Found a 5 line (30 tokens) duplication in the following files: +Starting at line 101 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 134 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 273 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java + + assertThat(elasticsearchAdminService.countAllDocuments(), equalTo(1L)); + + // check that auditing attributes have been set + mockMvc.perform(get(API_INSTRUMENTS_URI + "/" + instrument.getId())) + .andExpect(status().isOk()) +===================================================================== +Found a 4 line (30 tokens) duplication in the following files: +Starting at line 209 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 232 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 254 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentResourceControllerTest.java +Starting at line 139 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DaraServiceTest.java + + .content(TestUtil.convertObjectToJsonBytes(instrument)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()) + .andExpect( + jsonPath("$.errors[0].message", is("instrument-management.error.instrument.type.valid"))); +===================================================================== +Found a 3 line (30 tokens) duplication in the following files: +Starting at line 91 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java +Starting at line 132 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/instrumentmanagement/rest/InstrumentVersionsResourceTest.java + + .andExpect(jsonPath("$.length()", is(equalTo(1)))) + .andExpect(jsonPath("$[0].id", is(instrument.getId()))) + .andExpect(jsonPath("$[0].title.de", is(instrument.getTitle().getDe()))); +===================================================================== +Found a 4 line (30 tokens) duplication in the following files: +Starting at line 120 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DaraServiceTest.java +Starting at line 138 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DaraServiceTest.java + + mockMvc.perform(post("/api/data-acquisition-projects/" + project.getId() + "/release") + .content(TestUtil.convertObjectToJsonBytes(project)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 4 line (30 tokens) duplication in the following files: +Starting at line 138 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DaraServiceTest.java +Starting at line 409 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 458 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 470 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java + + .perform(post("/api/data-acquisition-projects/" + project.getMasterId() + "/release") + .content(TestUtil.convertObjectToJsonBytes(project)) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()).andExpect(jsonPath("$.errors[0].message", is( +===================================================================== +Found a 6 line (30 tokens) duplication in the following files: +Starting at line 114 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 223 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 284 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 343 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 401 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 417 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 433 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java + + buildValidProject(); + + // Act & Assert + mockMvc.perform(post(API_DATA_ACQUISITION_PROJECTS_POST_VALIDATION_URI)) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.errors", hasSize(0)));//no errors +===================================================================== +Found a 5 line (30 tokens) duplication in the following files: +Starting at line 205 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 264 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 326 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java +Starting at line 383 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectPostValidationResourceTest.java + + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "name3", 3, surveyNumbers); + this.variableRepository.save(variable3); + + //DataSet + DataSet dataSet = UnitTestCreateDomainObjectUtils.buildDataSet(project.getId(), survey.getId(), 1); +===================================================================== +Found a 2 line (30 tokens) duplication in the following files: +Starting at line 106 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 176 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 204 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 191 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectShadowsResourceTest.java +Starting at line 103 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java +Starting at line 147 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectVersionsResourceTest.java + + mockMvc.perform(post(API_DATA_ACQUISITION_PROJECTS_URI).contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))).andExpect(status().isCreated()); +===================================================================== +Found a 2 line (30 tokens) duplication in the following files: +Starting at line 136 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 149 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java + + mockMvc.perform(delete(API_DATA_ACQUISITION_PROJECTS_URI + "/" + project.getId()) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isNotFound()); +===================================================================== +Found a 7 line (30 tokens) duplication in the following files: +Starting at line 166 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 222 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java + + .andExpect(status().isOk()).andExpect(jsonPath("$.id", is(project.getId()))) + .andExpect(jsonPath("$.version", is(0))); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER) + public void testUpdateProject() throws IOException, Exception { +===================================================================== +Found a 3 line (30 tokens) duplication in the following files: +Starting at line 240 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 337 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 349 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 361 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java +Starting at line 369 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/rest/DataAcquisitionProjectResourceControllerTest.java + + .perform(post(API_DATA_ACQUISITION_PROJECTS_URI).contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(project))) + .andExpect(status().isBadRequest()) +===================================================================== +Found a 8 line (30 tokens) duplication in the following files: +Starting at line 112 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionImageResourceTest.java +Starting at line 103 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResponseRateImageResourceTest.java + + containsString("global.error.shadow-create-not-allowed"))); + } + + @Test + @WithMockUser(authorities = AuthoritiesConstants.PUBLISHER) + public void testUploadEmptyImage() throws Exception { + MockMultipartFile attachment = + new MockMultipartFile("image", "image.png", "image/png", "".getBytes()); +===================================================================== +Found a 3 line (30 tokens) duplication in the following files: +Starting at line 98 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 156 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java + + mockMvc.perform(put(API_QUESTIONS_URI + "/" + question.getId()) + .content(TestUtil.convertObjectToJsonBytes(question)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 5 line (30 tokens) duplication in the following files: +Starting at line 105 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 136 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 157 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java + + assertThat(elasticsearchAdminService.countAllDocuments(), equalTo(1L)); + + // check that auditing attributes have been set + mockMvc.perform(get(API_QUESTIONS_URI + "/" + question.getId())) + .andExpect(status().isOk()) +===================================================================== +Found a 2 line (30 tokens) duplication in the following files: +Starting at line 130 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 180 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 220 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 246 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 322 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java + + mockMvc.perform(post(API_QUESTIONS_URI).content(TestUtil.convertObjectToJsonBytes(question)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); +===================================================================== +Found a 3 line (30 tokens) duplication in the following files: +Starting at line 271 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 288 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 305 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 344 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java + + mockMvc.perform(put(API_QUESTIONS_URI + "/" + question.getId()) + .content(TestUtil.convertObjectToJsonBytes(question)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()); +===================================================================== +Found a 4 line (30 tokens) duplication in the following files: +Starting at line 339 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 352 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java +Starting at line 366 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/questionmanagement/rest/QuestionResourceControllerTest.java + + public void testCreateShadowCopyQuestion() throws Exception { + Question question = UnitTestCreateDomainObjectUtils + .buildQuestion("issue1991", 123, "instrument-Id"); + question.setId(question.getId() + "-1.0.0"); +===================================================================== +Found a 3 line (30 tokens) duplication in the following files: +Starting at line 125 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 211 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java +Starting at line 246 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/relatedpublicationmanagement/rest/RelatedPublicationResourceControllerTest.java + + this.mockMvc.perform(post(API_RELATED_PUBLICATION_URI) + .content(TestUtil.convertObjectToJsonBytes(relatedPublication)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); +===================================================================== +Found a 5 line (30 tokens) duplication in the following files: +Starting at line 95 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/rest/SearchResourceTest.java +Starting at line 107 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 139 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 184 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 202 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 220 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 238 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 264 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 292 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 322 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 350 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 373 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 403 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 435 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 455 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 472 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 490 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 508 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 529 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 547 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 612 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 681 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 701 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 721 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 741 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 761 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 781 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 801 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 827 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 846 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + List surveyNumbers = new ArrayList(); + surveyNumbers.add(1); + + Variable variable = + UnitTestCreateDomainObjectUtils.buildVariable(project.getId(), 1, "var1", 1, surveyNumbers); +===================================================================== +Found a 3 line (30 tokens) duplication in the following files: +Starting at line 253 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyAttachmentResourceTest.java +Starting at line 118 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 103 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java + + mockMvc.perform(put("/api/surveys/" + survey.getId()) + .content(TestUtil.convertObjectToJsonBytes(survey)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isCreated()); +===================================================================== +Found a 3 line (30 tokens) duplication in the following files: +Starting at line 194 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 215 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 234 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java +Starting at line 383 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResourceControllerTest.java + + mockMvc.perform(put(API_SURVEYS_URI + "/" + survey.getId()) + .content(TestUtil.convertObjectToJsonBytes(survey)).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isBadRequest()); +===================================================================== +Found a 5 line (30 tokens) duplication in the following files: +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResponseRateImageResourceTest.java +Starting at line 110 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResponseRateImageResourceTest.java +Starting at line 128 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResponseRateImageResourceTest.java +Starting at line 158 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyResponseRateImageResourceTest.java + + new MockMultipartFile("image", FILE_NAME, "image/png", "fakeimage".getBytes()); + SurveyResponseRateImageMetadata surveyResponseRateImageMetadata = + createResponseRateImageMetadata(); + MockMultipartFile metadata = new MockMultipartFile("surveyResponseRateImageMetadata", FILE_NAME, + "application/json", TestUtil.convertObjectToJsonBytes(surveyResponseRateImageMetadata)); +===================================================================== +Found a 3 line (30 tokens) duplication in the following files: +Starting at line 89 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java +Starting at line 124 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/rest/SurveyVersionsResourceTest.java + + .andExpect(jsonPath("$.length()", is(equalTo(1)))) + .andExpect(jsonPath("$[0].id", is(survey.getId()))) + .andExpect(jsonPath("$[0].title.de", is(survey.getTitle().getDe()))); +===================================================================== +Found a 4 line (30 tokens) duplication in the following files: +Starting at line 119 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java +Starting at line 80 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/UserResourceTest.java +Starting at line 116 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/UserResourceTest.java + + restUserMockMvc.perform(get("/api/account").accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) + .andExpect(jsonPath("$.login").value("test")) +===================================================================== +Found a 9 line (30 tokens) duplication in the following files: +Starting at line 147 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java +Starting at line 167 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java +Starting at line 246 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java + + .perform(get("/api/activate?key=testActivateTrue").accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()); + + // Delete + this.userRepository.deleteById(user.getId()); + } + + @Test + public void testRequestPasswordReset() throws Exception { +===================================================================== +Found a 2 line (30 tokens) duplication in the following files: +Starting at line 184 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java +Starting at line 245 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java + + this.restMvc.perform(post("/api/account").contentType(MediaType.APPLICATION_JSON) + .content(TestUtil.convertObjectToJsonBytes(dto))).andExpect(status().isOk()); +===================================================================== +Found a 7 line (30 tokens) duplication in the following files: +Starting at line 221 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java +Starting at line 273 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/usermanagement/rest/AccountResourceTest.java + + .content("john.doe@jhipter.com")).andExpect(status().is4xxClientError()); + + this.userRepository.deleteById(user.getId()); + } + + @Test + public void testFinishPasswordReset() throws Exception { +===================================================================== +Found a 2 line (30 tokens) duplication in the following files: +Starting at line 146 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 254 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 281 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 592 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 622 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 649 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 730 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 790 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 807 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + mockMvc.perform(post(API_VARIABLES_URI).content(TestUtil.convertObjectToJsonBytes(variable)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isCreated()); +===================================================================== +Found a 3 line (30 tokens) duplication in the following files: +Starting at line 174 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 192 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 210 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 228 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 330 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 463 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 480 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 498 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 516 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 537 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 556 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 574 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 690 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 710 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 750 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 770 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java +Starting at line 874 of /home/reitmann/data/metadatamanagement/src/test/java/eu/dzhw/fdz/metadatamanagement/variablemanagement/rest/VariableResourceControllerTest.java + + mockMvc.perform(put(API_VARIABLES_URI + "/" + variable.getId()) + .content(TestUtil.convertObjectToJsonBytes(variable)) + .contentType(MediaType.APPLICATION_JSON)).andExpect(status().isBadRequest()); +===================================================================== +Found a 10 line (30 tokens) duplication in the following files: +Starting at line 39 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/common/domain/QAbstractShadowableRdcDomainObject.java +Starting at line 41 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataPackageNestedDocument.java +Starting at line 45 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetNestedDocument.java +Starting at line 45 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentNestedDocument.java +Starting at line 43 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveyNestedDocument.java +Starting at line 47 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableNestedDocument.java + + public final DateTimePath lastModifiedDate = _super.lastModifiedDate; + + public final StringPath masterId = createString("masterId"); + + public final BooleanPath shadow = createBoolean("shadow"); + + public final StringPath successorId = createString("successorId"); + + //inherited + public final NumberPath version = _super.version; +===================================================================== +Found a 2 line (30 tokens) duplication in the following files: +Starting at line 154 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java +Starting at line 149 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 168 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 158 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java +Starting at line 180 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + this.dataPackage = inits.isInitialized("dataPackage") ? new QDataPackageSubDocument(forProperty("dataPackage"), inits.get("dataPackage")) : null; + this.dataPackageId = _super.dataPackageId; +===================================================================== +Found a 2 line (30 tokens) duplication in the following files: +Starting at line 165 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QDataSetSearchDocument.java +Starting at line 151 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QInstrumentSearchDocument.java +Starting at line 171 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QQuestionSearchDocument.java +Starting at line 160 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QSurveySearchDocument.java +Starting at line 183 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSearchDocument.java + + this.nestedDataPackage = inits.isInitialized("nestedDataPackage") ? new QDataPackageNestedDocument(forProperty("nestedDataPackage"), inits.get("nestedDataPackage")) : null; + this.number = _super.number; +===================================================================== +Found a 8 line (30 tokens) duplication in the following files: +Starting at line 37 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableNestedDocument.java +Starting at line 39 of /home/reitmann/data/metadatamanagement/target/generated-sources/java/eu/dzhw/fdz/metadatamanagement/searchmanagement/documents/QVariableSubDocument.java + + public final StringPath dataSetId = createString("dataSetId"); + + public final StringPath id = createString("id"); + + public final eu.dzhw.fdz.metadatamanagement.common.domain.QI18nString label; + + //inherited + public final StringPath lastModifiedBy; diff --git a/src/main/java/eu/dzhw/fdz/metadatamanagement/common/domain/Task.java b/src/main/java/eu/dzhw/fdz/metadatamanagement/common/domain/Task.java index 81d4687330..9e24f7d11f 100644 --- a/src/main/java/eu/dzhw/fdz/metadatamanagement/common/domain/Task.java +++ b/src/main/java/eu/dzhw/fdz/metadatamanagement/common/domain/Task.java @@ -70,6 +70,6 @@ public enum TaskState { * */ public enum TaskType { - DATA_SET_REPORT + DATA_SET_REPORT, DATA_PACKAGE_OVERVIEW } } diff --git a/src/main/java/eu/dzhw/fdz/metadatamanagement/common/service/AbstractReportService.java b/src/main/java/eu/dzhw/fdz/metadatamanagement/common/service/AbstractReportService.java new file mode 100644 index 0000000000..a7e5132d8e --- /dev/null +++ b/src/main/java/eu/dzhw/fdz/metadatamanagement/common/service/AbstractReportService.java @@ -0,0 +1,249 @@ +package eu.dzhw.fdz.metadatamanagement.common.service; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.StringWriter; +import java.io.Writer; +import java.net.URI; +import java.nio.charset.StandardCharsets; +import java.nio.file.FileSystem; +import java.nio.file.FileSystems; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.javers.common.collections.Lists; +import org.springframework.scheduling.annotation.Async; + +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; +import eu.dzhw.fdz.metadatamanagement.common.domain.Task; +import eu.dzhw.fdz.metadatamanagement.common.rest.util.ZipUtil; +import eu.dzhw.fdz.metadatamanagement.datapackagemanagement.service.DataPackageOverviewService; +import eu.dzhw.fdz.metadatamanagement.datasetmanagement.exception.TemplateIncompleteException; +import eu.dzhw.fdz.metadatamanagement.datasetmanagement.service.DataSetReportService; +import eu.dzhw.fdz.metadatamanagement.filemanagement.service.FileService; +import eu.dzhw.fdz.metadatamanagement.variablemanagement.domain.AccessWays; +import freemarker.template.Configuration; +import freemarker.template.Template; +import freemarker.template.TemplateException; +import freemarker.template.TemplateExceptionHandler; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * Base class for generating reports like {@link DataSetReportService} and + * {@link DataPackageOverviewService}. + * + * It configures freemarker and executes it. The Model for the templates must be provided by the + * concrete sub classes. + */ +@RequiredArgsConstructor +@Slf4j +public abstract class AbstractReportService { + protected final FileService fileService; + + protected final TaskManagementService taskService; + + protected final MarkdownHelper markdownHelper; + + /** + * The Escape Prefix handles the escaping of special latex signs within data information. This + * Prefix will be copied before the template source code. + */ + protected static final String ESCAPE_PREFIX = + "<#escape x as x?replace(\"\\\\\", \"\\\\textbackslash{}\")" + + "?replace(\"{\", \"\\\\{\")?replace(\"}\", \"\\\\}\")" + + "?replace(\"#\", \"\\\\#\")?replace(\"$\", \"\\\\$\")" + + "?replace(\"%\", \"\\\\%\")?replace(\"&\", \"\\\\&\")" + + "?replace(\"^\", \"\\\\textasciicircum{}\")?replace(\"_\", \"\\\\_\")" + + "?replace(\">\", \"\\\\textgreater{}\")?replace(\"<\", \"\\\\textless{}\")" + + "?replace(\"~\", \"\\\\textasciitilde{}\")" + "?replace(\"\\r\\n\", \"\\\\par \")" + + "?replace(\"\\n\", \"\\\\par \")>"; + + /** + * The Escape Suffix closes the escaping prefix. This Prefix will be copied after the template + * source code. + */ + protected static final String ESCAPE_SUFFIX = ""; + + /** + * Zip Mime Content Type. + */ + protected static final String CONTENT_TYPE_ZIP = "application/zip"; + + /** + * Get all filenames expected to be present in the template zip. + * + * @return List of expected filenames + */ + private List getExpectedFiles() { + return Lists.join(getSimpleTemplateFiles(), getComplexTemplateFiles()); + } + + /** + * Get all filenames of template which can be simply processed. + * + * @return List of simple to process files. + */ + protected abstract List getSimpleTemplateFiles(); + + /** + * Get all filenames of template which need to be processed in a more complex way (like + * "Variable.tex"). + * + * @return List of simple to process files. + */ + protected abstract List getComplexTemplateFiles(); + + /** + * This method load all needed objects from the db for filling the tex template. + * + * @param id the id of the dataset or data package. + * @param version The version of the report as it is displayed in the title. + * @return A HashMap with all data for the template filling. The Key is the name of the Object, + * which is used in the template. + */ + protected abstract Map loadDataForTemplateFilling(String id, String version); + + /** + * Checks for all files which are included for the tex template. + * + * @param zipFileSystem The zip file as file system + * @return True if all files are included. False min one file is missing. + */ + private List validateZipStructure(FileSystem zipFileSystem) { + List missingTexFiles = new ArrayList<>(); + + this.getExpectedFiles().forEach(filename -> { + Path file = zipFileSystem.getPath(zipFileSystem.getPath("/").toString(), filename); + if (!Files.exists(file)) { + missingTexFiles.add(filename); + } + }); + return missingTexFiles; + } + + /** + * This method save a latex file into GridFS/MongoDB based on a byteArrayOutputStream. + * + * @param fileName The name of the file to be saved + * @return return the file name of the saved latex template in the GridFS / MongoDB. + * @throws IOException thrown if a stream cannot be closed + */ + @SuppressFBWarnings("OBL_UNSATISFIED_OBLIGATION") + private String saveCompleteZipFile(File zipFile, String fileName) throws IOException { + // No Update by API, so we have to delete first. + fileService.deleteTempFile(fileName); + // Save tex file + return fileService.saveTempFile(new FileInputStream(zipFile), fileName, CONTENT_TYPE_ZIP); + } + + /** + * This method fills the tex templates. + * + * @param templateContent The content of a tex template. + * @param templateConfiguration The configuration for freemarker. + * @param fileName filename of the script which will be filled in this method. + * @return The filled tex templates as byte array. + * @throws IOException Handles IO Exception. + * @throws TemplateException Handles template Exceptions. + */ + protected final String fillTemplate(String templateContent, Configuration templateConfiguration, + Map dataForTemplate, String fileName) throws IOException, TemplateException { + String templateName = "texTemplate"; + if (fileName != null && fileName.trim().length() > 0) { + templateName = fileName; + } + + // Read Template and escape elements + Template texTemplate = new Template(templateName, + ESCAPE_PREFIX + templateContent + ESCAPE_SUFFIX, templateConfiguration); + + try (Writer stringWriter = new StringWriter()) { + texTemplate.process(dataForTemplate, stringWriter); + + stringWriter.flush(); + return stringWriter.toString(); + } + } + + /** + * This service method will receive a tex template as a string and an id of a data set. With this + * id, the service will load the data set for receiving all depending information, which are + * needed for filling of the tex template with data. + * + * @param zipTmpFilePath The path to uploaded zip file + * @param originalName the original name of multipartfile + * @param id An id of the dataset or data package. + * @param task the task to update the status of the pro + * @param version The version of the report as it is displayed in the title. + * + * @throws TemplateException Handles templates exceptions. + * @throws IOException Handles IO Exception for the template. + */ + @Async + public void generateReport(Path zipTmpFilePath, String originalName, String id, Task task, + String version) { + log.debug("Start generating report/overview for {} and id {}", originalName, id); + // Configuration, based on Freemarker Version 2.3.23 + Configuration templateConfiguration = new Configuration(Configuration.VERSION_2_3_23); + templateConfiguration.setDefaultEncoding(StandardCharsets.UTF_8.toString()); + templateConfiguration.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); + templateConfiguration.setNumberFormat("0.######"); + templateConfiguration.setAPIBuiltinEnabled(true); + URI uriOfZipFile = URI.create("jar:" + zipTmpFilePath.toUri()); + // Prepare Zip enviroment config + Map env = new HashMap<>(); + env.put("create", "true"); + env.put("encoding", StandardCharsets.UTF_8.name()); + try (FileSystem zipFileSystem = FileSystems.newFileSystem(uriOfZipFile, env);) { + // Check missing files. + log.debug("Check missing files."); + List missingTexFiles = this.validateZipStructure(zipFileSystem); + if (!missingTexFiles.isEmpty()) { + String message = "common.error" + ".files-in-template-zip-incomplete"; + log.debug(message + missingTexFiles); + throw new TemplateIncompleteException(message, missingTexFiles); + } + // Load data for template only once + Map dataForTemplate = this.loadDataForTemplateFilling(id, version); + + dataForTemplate.put("removeMarkdown", markdownHelper.createRemoveMarkdownMethod()); + dataForTemplate.put("displayAccessWay", AccessWays.createDisplayAccessWayMethod()); + + for (String filename : getSimpleTemplateFiles()) { + String template = ZipUtil.readFileFromZip(zipFileSystem.getPath(filename)); + String filledTemplate = + this.fillTemplate(template, templateConfiguration, dataForTemplate, filename); + ZipUtil.writeFileToZip(zipFileSystem.getPath(filename), filledTemplate); + } + + // Create Variables pages + for (String filename : getComplexTemplateFiles()) { + handleComplexTemplateFile(filename, zipFileSystem, dataForTemplate, templateConfiguration); + } + + // Save into MongoDB / GridFS + zipFileSystem.close(); + File zipTmpFile = zipTmpFilePath.toFile(); + String fileName = this.saveCompleteZipFile(zipTmpFile, originalName); + log.debug("file saved, start #handletaskDone"); + taskService.handleTaskDone(task, fileName); + } catch (RuntimeException e) { + log.error("failed generating report", e); + taskService.handleErrorTask(task, e); + throw e; + } catch (Exception e) { + log.error("failed generating report", e); + taskService.handleErrorTask(task, e); + } + } + + protected void handleComplexTemplateFile(String templateFilename, FileSystem zipFileSystem, + Map dataForTemplate, Configuration templateConfiguration) + throws IOException, TemplateException {} +} diff --git a/src/main/java/eu/dzhw/fdz/metadatamanagement/common/service/TaskManagementService.java b/src/main/java/eu/dzhw/fdz/metadatamanagement/common/service/TaskManagementService.java index 91fc8d9289..d63a7df671 100644 --- a/src/main/java/eu/dzhw/fdz/metadatamanagement/common/service/TaskManagementService.java +++ b/src/main/java/eu/dzhw/fdz/metadatamanagement/common/service/TaskManagementService.java @@ -1,5 +1,6 @@ package eu.dzhw.fdz.metadatamanagement.common.service; +import java.io.IOException; import java.time.LocalDateTime; import java.util.List; import java.util.Optional; @@ -7,11 +8,26 @@ import javax.validation.constraints.NotNull; import org.apache.commons.lang3.NotImplementedException; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.loader.tools.RunProcess; +import org.springframework.core.env.Environment; +import org.springframework.core.env.Profiles; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.security.access.annotation.Secured; import org.springframework.stereotype.Service; +import com.amazonaws.services.ecs.AmazonECS; +import com.amazonaws.services.ecs.model.ContainerOverride; +import com.amazonaws.services.ecs.model.DescribeServicesRequest; +import com.amazonaws.services.ecs.model.LaunchType; +import com.amazonaws.services.ecs.model.NetworkConfiguration; +import com.amazonaws.services.ecs.model.RunTaskRequest; +import com.amazonaws.services.ecs.model.TaskOverride; + +import eu.dzhw.fdz.metadatamanagement.common.config.Constants; +import eu.dzhw.fdz.metadatamanagement.common.config.MetadataManagementProperties; +import eu.dzhw.fdz.metadatamanagement.common.config.MetadataManagementProperties.ReportTask; import eu.dzhw.fdz.metadatamanagement.common.domain.Task; import eu.dzhw.fdz.metadatamanagement.common.domain.Task.TaskState; import eu.dzhw.fdz.metadatamanagement.common.domain.Task.TaskType; @@ -54,6 +70,13 @@ public class TaskManagementService implements CrudService { private final TaskCrudHelper crudHelper; + private final Environment environment; + + private final MetadataManagementProperties metadataManagementProperties; + + @Autowired(required = false) + private AmazonECS ecsClient; + /** * Create a task. * @@ -96,6 +119,10 @@ public void handleErrorNotification(TaskErrorNotification errorNotification, Use case DATA_SET_REPORT: handleDataSetReportError(errorNotification, onBehalfUser, projectManagementEmailSender); break; + case DATA_PACKAGE_OVERVIEW: + handleDataPackageOverviewError(errorNotification, onBehalfUser, + projectManagementEmailSender); + break; default: throw new NotImplementedException("Handling of errors for " + errorNotification.getTaskType() + " has not been implemented yet."); @@ -110,6 +137,14 @@ private void handleDataSetReportError(TaskErrorNotification errorNotification, U projectManagementEmailSender); } + private void handleDataPackageOverviewError(TaskErrorNotification errorNotification, + User onBehalfUser, String projectManagementEmailSender) { + List admins = + userRepository.findAllByAuthoritiesContaining(new Authority(AuthoritiesConstants.ADMIN)); + mailService.sendDataPackageOverviewErrorMail(onBehalfUser, admins, errorNotification, + projectManagementEmailSender); + } + /** * Mark the task as done. * @@ -193,4 +228,49 @@ public Task create(Task domainObject) { public Optional readSearchDocument(String id) { return crudHelper.readSearchDocument(id); } + + /** + * Start one container per language which builds the report/overview. Either via aws fargate or + * locally via docker. + * + * @param id The id of the dataSet or data package for which the report/overview will be + * generated. + * @param languages The languages in which we need to generate the report. Currently supported + * 'de', 'en'. + * @param version The version of the dataset report/data package overview. + * @param onBehalfOf The name of the user which wants to generate the report. + * @throws IOException in case the local task cannot be started + */ + public void startReportTasks(String id, String version, List languages, + String onBehalfOf, TaskType taskType) throws IOException { + for (String language : languages) { + if (environment.acceptsProfiles(Profiles.of(Constants.SPRING_PROFILE_LOCAL))) { + log.debug("Starting docker container from image report-task..."); + RunProcess dataSetReportTaskContainer = + new RunProcess("src/main/resources/bin/run-report-task.sh", id, version, + language, onBehalfOf, taskType.name()); + dataSetReportTaskContainer.run(false); + } else { + ReportTask taskProperties = metadataManagementProperties.getReportTask(); + log.info("Starting fargate task {}...", taskProperties.getTaskDefinition()); + NetworkConfiguration networkConfiguration = ecsClient + .describeServices( + new DescribeServicesRequest().withCluster(taskProperties.getClusterName()) + .withServices(taskProperties.getServiceName())) + .getServices().get(0).getNetworkConfiguration(); + + RunTaskRequest req = + new RunTaskRequest().withTaskDefinition(taskProperties.getTaskDefinition()) + .withNetworkConfiguration(networkConfiguration) + .withCluster(taskProperties.getClusterName()).withLaunchType(LaunchType.FARGATE) + .withCount(1).withStartedBy( + onBehalfOf) + .withOverrides(new TaskOverride().withContainerOverrides( + new ContainerOverride().withName(taskProperties.getContainerName()) + .withCommand(String.format(taskProperties.getStartCommand(), id, + version, language, onBehalfOf, taskType.name()).split("\\s+")))); + ecsClient.runTask(req); + } + } + } } diff --git a/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageOverviewResource.java b/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageOverviewResource.java new file mode 100644 index 0000000000..1d33caf37e --- /dev/null +++ b/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/rest/DataPackageOverviewResource.java @@ -0,0 +1,136 @@ +package eu.dzhw.fdz.metadatamanagement.datapackagemanagement.rest; + +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.annotation.Secured; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.multipart.MultipartFile; + +import eu.dzhw.fdz.metadatamanagement.common.domain.Task; +import eu.dzhw.fdz.metadatamanagement.common.domain.Task.TaskType; +import eu.dzhw.fdz.metadatamanagement.common.service.TaskManagementService; +import eu.dzhw.fdz.metadatamanagement.datapackagemanagement.domain.DataPackage; +import eu.dzhw.fdz.metadatamanagement.datapackagemanagement.service.DataPackageAttachmentService; +import eu.dzhw.fdz.metadatamanagement.datapackagemanagement.service.DataPackageOverviewService; +import eu.dzhw.fdz.metadatamanagement.datasetmanagement.exception.TemplateIncompleteException; +import eu.dzhw.fdz.metadatamanagement.mailmanagement.service.MailService; +import eu.dzhw.fdz.metadatamanagement.usermanagement.domain.User; +import eu.dzhw.fdz.metadatamanagement.usermanagement.security.AuthoritiesConstants; +import eu.dzhw.fdz.metadatamanagement.usermanagement.security.UserInformationProvider; +import freemarker.template.TemplateException; +import lombok.RequiredArgsConstructor; + +/** + * This Resource handles the filling of the tex template and the upload of the compiled file for + * creating data package overview. + */ +@Controller +@RequestMapping("/api") +@RequiredArgsConstructor +public class DataPackageOverviewResource { + private final MailService mailService; + + private final DataPackageOverviewService dataPackageOverviewService; + + private final DataPackageAttachmentService dataPackageAttachmentService; + + private final UserInformationProvider userInformationProvider; + + private final TaskManagementService taskService; + + @Value("${metadatamanagement.projectmanagement.email}") + private String sender; + + /** + * Start the generation of a data package overview for the given {@link DataPackage}. + * + * @param dataPackageId The id of the {@link DataPackage} for which we need to generate the + * overview. + * @param version The version of the DOI in the overview. + * @param languages List of languages for which the report needs to be generated. Currently only + * de, en. + * @return ok if the generation has been started successfully. + * @throws IOException If the external task cannot be started. + */ + @PostMapping(value = "/data-packages/{dataPackageId}/overview/generate/{version:.+}") + @Secured(value = {AuthoritiesConstants.PUBLISHER, AuthoritiesConstants.DATA_PROVIDER}) + public ResponseEntity startOverviewGeneration( + @PathVariable("dataPackageId") String dataPackageId, @PathVariable("version") String version, + HttpServletRequest request, + @RequestParam(name = "languages", defaultValue = "de") List languages) + throws IOException { + taskService.startReportTasks(dataPackageId, version, languages, + request.getUserPrincipal().getName(), TaskType.DATA_PACKAGE_OVERVIEW); + return ResponseEntity.ok().build(); + } + + /** + * Fill the given zip file which contains latex templates. + * + * @param templateZip The latex template as multipart file + * @param dataPackageId the id of the data package, for which the template needs to be processed + * @param version The version of the DOI of the data package + * @throws IOException Handles io exception for the template. (Freemarker Templates) + * @throws TemplateException Handles template exceptions. (Freemarker Templates) + */ + @PostMapping(value = "/data-packages/{dataPackageId}/overview/fill-template") + @Secured(value = {AuthoritiesConstants.TASK_USER}) + public ResponseEntity fillTemplate(@RequestParam("file") MultipartFile templateZip, + @PathVariable("dataPackageId") String dataPackageId, @RequestParam("version") String version) + throws IOException, TemplateException, TemplateIncompleteException { + + // Handles no empty latex templates + if (!templateZip.isEmpty()) { + Path zipTmpFilePath = Files.createTempFile(dataPackageId.replace("!", ""), ".zip"); + File zipTmpFile = zipTmpFilePath.toFile(); + templateZip.transferTo(zipTmpFile); + zipTmpFile.setWritable(true); + Task task = taskService.createTask(Task.TaskType.DATA_PACKAGE_OVERVIEW); + URI pollUri = URI.create("/api/tasks/" + task.getId()); + // fill the data with data and store the template into mongodb / gridfs + dataPackageOverviewService.generateReport(zipTmpFilePath, templateZip.getOriginalFilename(), + dataPackageId, task, version); + return ResponseEntity.accepted().location(pollUri).body(task); + } else { + // Return bad request, if file is empty. + return ResponseEntity.badRequest().body(null); + } + } + + /** + * Upload the generated data package overview and attach it to the given {@link DataPackage}. + * + * @param overviewFile The pdf overview to attach to the given {@link DataPackage} + * @param language The language of the overview. Currently supports only 'de' or 'en'. + * @param dataPackageId The id of the {@link DataPackage} to which this file shall be attached. + * @param onBehalfOf Username of the MDM user who will receive an email, when the report has been + * successfully attached. + * @return 200 if attaching succeeded. + * @throws IOException Thrown if the multipart file cannot be read. + */ + @PostMapping(value = "/data-packages/{dataPackageId}/overview/{language}") + @Secured(value = {AuthoritiesConstants.TASK_USER}) + public ResponseEntity uploadOverview(@RequestParam("file") MultipartFile overviewFile, + @PathVariable("dataPackageId") String dataPackageId, + @RequestParam("onBehalfOf") String onBehalfOf, @PathVariable("language") String language) + throws IOException { + User user = userInformationProvider.switchToUser(onBehalfOf); + dataPackageAttachmentService.attachDataPackageOverview(dataPackageId, language, overviewFile); + mailService.sendDataPackageOverviewGeneratedMail(user, dataPackageId, language, sender); + userInformationProvider.switchToUser(null); + return ResponseEntity.ok().build(); + } +} diff --git a/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentService.java b/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentService.java index 722453bd83..c0658c8db0 100644 --- a/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentService.java +++ b/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageAttachmentService.java @@ -17,10 +17,14 @@ import com.mongodb.client.gridfs.model.GridFSFile; +import eu.dzhw.fdz.metadatamanagement.common.domain.I18nString; import eu.dzhw.fdz.metadatamanagement.common.domain.ShadowCopyCreateNotAllowedException; import eu.dzhw.fdz.metadatamanagement.common.domain.ShadowCopyDeleteNotAllowedException; import eu.dzhw.fdz.metadatamanagement.common.service.AttachmentMetadataHelper; +import eu.dzhw.fdz.metadatamanagement.datapackagemanagement.domain.DataPackage; import eu.dzhw.fdz.metadatamanagement.datapackagemanagement.domain.DataPackageAttachmentMetadata; +import eu.dzhw.fdz.metadatamanagement.datapackagemanagement.domain.DataPackageAttachmentTypes; +import eu.dzhw.fdz.metadatamanagement.datapackagemanagement.repository.DataPackageRepository; import eu.dzhw.fdz.metadatamanagement.datapackagemanagement.service.helper.DataPackageAttachmentFilenameBuilder; import eu.dzhw.fdz.metadatamanagement.projectmanagement.domain.DataAcquisitionProject; import eu.dzhw.fdz.metadatamanagement.usermanagement.security.SecurityUtils; @@ -32,6 +36,7 @@ @Service @RequiredArgsConstructor public class DataPackageAttachmentService { + private final DataPackageRepository dataPackageRepository; private final GridFsOperations operations; @@ -181,4 +186,42 @@ public void deleteByDataPackageIdAndFilename(String dataPackageId, String filena this.operations.delete(fileQuery); javers.commitShallowDelete(currentUser, metadata); } + + /** + * Attach the given file as data package overview to the data package. + * + * @param language The language of the report. + * @param dataPackageId The id of a {@link DataPackage}. + * @param overviewFile The pdf file. + * @throws IOException Thrown if the multipart file cannot be read. + */ + public void attachDataPackageOverview(String dataPackageId, String language, + MultipartFile overviewFile) throws IOException { + DataPackage dataPackage = dataPackageRepository.findById(dataPackageId).get(); + DataPackageAttachmentMetadata metadata = null; + switch (language) { + case "de": + metadata = DataPackageAttachmentMetadata.builder().dataPackageId(dataPackageId) + .dataAcquisitionProjectId(dataPackage.getDataAcquisitionProjectId()) + .fileName(dataPackage.getDataAcquisitionProjectId() + "_Overview_de.pdf") + .title(dataPackage.getTitle().getDe()) + .description(new I18nString("Datenpaketübersicht", "Data Package Overview")) + .type(DataPackageAttachmentTypes.OTHER) + .language("de").indexInDataPackage(-1).build(); + break; + case "en": + metadata = DataPackageAttachmentMetadata.builder().dataPackageId(dataPackageId) + .dataAcquisitionProjectId(dataPackage.getDataAcquisitionProjectId()) + .fileName(dataPackage.getDataAcquisitionProjectId() + "_Overview_en.pdf") + .title(dataPackage.getTitle().getEn()) + .description(new I18nString("Datenpaketübersicht", "Data Package Overview")) + .type(DataPackageAttachmentTypes.OTHER) + .language("en").indexInDataPackage(-2).build(); + break; + default: + throw new IllegalArgumentException("Unsupported language '" + language + "'!"); + } + deleteByDataPackageIdAndFilename(dataPackageId, metadata.getFileName()); + createDataPackageAttachment(overviewFile, metadata); + } } diff --git a/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageOverviewService.java b/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageOverviewService.java new file mode 100644 index 0000000000..883233d0ee --- /dev/null +++ b/src/main/java/eu/dzhw/fdz/metadatamanagement/datapackagemanagement/service/DataPackageOverviewService.java @@ -0,0 +1,266 @@ +package eu.dzhw.fdz.metadatamanagement.datapackagemanagement.service; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Comparator; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.apache.commons.lang3.tuple.Pair; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import com.google.common.collect.Lists; + +import eu.dzhw.fdz.metadatamanagement.common.domain.I18nString; +import eu.dzhw.fdz.metadatamanagement.common.domain.Period; +import eu.dzhw.fdz.metadatamanagement.common.service.AbstractReportService; +import eu.dzhw.fdz.metadatamanagement.common.service.MarkdownHelper; +import eu.dzhw.fdz.metadatamanagement.common.service.TaskManagementService; +import eu.dzhw.fdz.metadatamanagement.datapackagemanagement.domain.DataPackage; +import eu.dzhw.fdz.metadatamanagement.datapackagemanagement.repository.DataPackageRepository; +import eu.dzhw.fdz.metadatamanagement.datasetmanagement.domain.DataSet; +import eu.dzhw.fdz.metadatamanagement.datasetmanagement.domain.SubDataSet; +import eu.dzhw.fdz.metadatamanagement.datasetmanagement.repository.DataSetRepository; +import eu.dzhw.fdz.metadatamanagement.filemanagement.service.FileService; +import eu.dzhw.fdz.metadatamanagement.projectmanagement.domain.Release; +import eu.dzhw.fdz.metadatamanagement.projectmanagement.service.helper.DoiBuilder; +import eu.dzhw.fdz.metadatamanagement.surveymanagement.domain.DataTypes; +import eu.dzhw.fdz.metadatamanagement.surveymanagement.domain.Population; +import eu.dzhw.fdz.metadatamanagement.surveymanagement.domain.Survey; +import eu.dzhw.fdz.metadatamanagement.surveymanagement.repository.SurveyRepository; +import eu.dzhw.fdz.metadatamanagement.variablemanagement.domain.AccessWays; + +/** + * This service generated the data package overview. It fill the tex template using freemarker. + */ +@Service +public class DataPackageOverviewService extends AbstractReportService { + private final SurveyRepository surveyRepository; + private final DataPackageRepository dataPackageRepository; + private final DataSetRepository dataSetRepository; + private final DoiBuilder doiBuilder; + + @Value("${metadatamanagement.server.context-root}") + private String baseUrl; + + /** + * Instantiate and autowire the service. + */ + public DataPackageOverviewService(FileService fileService, TaskManagementService taskService, + MarkdownHelper markdownHelper, SurveyRepository surveyRepository, + DataPackageRepository dataPackageRepository, DataSetRepository dataSetRepository, + DoiBuilder doiBuilder) { + super(fileService, taskService, markdownHelper); + this.surveyRepository = surveyRepository; + this.dataPackageRepository = dataPackageRepository; + this.dataSetRepository = dataSetRepository; + this.doiBuilder = doiBuilder; + } + + @Override + protected Map loadDataForTemplateFilling(String dataPackageId, String version) { + // Create Map for the template + Map dataForTemplate = new HashMap<>(); + DataPackage dataPackage = dataPackageRepository.findById(dataPackageId).orElse(null); + dataForTemplate.put("dataPackage", dataPackage); + List surveys = + surveyRepository.findByDataPackageIdOrderBySerialNumberAscNumberAsc(dataPackageId); + + List surveyDataTypes = + surveys.stream().map(Survey::getDataType).distinct().collect(Collectors.toList()); + dataForTemplate.put("surveyDataTypes", surveyDataTypes); + + // create deduplicated strings for displaying survey information + Map> surveyAnnotationsMapDe = new LinkedHashMap<>(); + Map> surveyAnnotationsMapEn = new LinkedHashMap<>(); + Map> surveySampleMapDe = new LinkedHashMap<>(); + Map> surveySampleMapEn = new LinkedHashMap<>(); + Map> surveyMethodMapDe = new LinkedHashMap<>(); + Map> surveyMethodMapEn = new LinkedHashMap<>(); + Map> populationDescriptionMapDe = new LinkedHashMap<>(); + Map> populationDescriptionMapEn = new LinkedHashMap<>(); + Map> surveyPeriodMap = new LinkedHashMap<>(); + + Map cleanedResponseRatesMap = new LinkedHashMap<>(); + + int surveyIndex = 0; + for (Survey survey : surveys) { + surveyIndex++; + fillMap(surveyAnnotationsMapDe, surveyIndex, survey, Survey::getAnnotations, + I18nString::getDe); + fillMap(surveyAnnotationsMapEn, surveyIndex, survey, Survey::getAnnotations, + I18nString::getEn); + fillMap(surveySampleMapDe, surveyIndex, survey, Survey::getSample, I18nString::getDe); + fillMap(surveySampleMapEn, surveyIndex, survey, Survey::getSample, I18nString::getEn); + fillMap(surveyMethodMapDe, surveyIndex, survey, Survey::getSurveyMethod, I18nString::getDe); + fillMap(surveyMethodMapEn, surveyIndex, survey, Survey::getSurveyMethod, I18nString::getEn); + fillMap(populationDescriptionMapDe, surveyIndex, survey.getPopulation(), + Population::getDescription, I18nString::getDe); + fillMap(populationDescriptionMapEn, surveyIndex, survey.getPopulation(), + Population::getDescription, I18nString::getEn); + fillMap(surveyPeriodMap, surveyIndex, survey, Survey::getFieldPeriod); + + if (survey.getResponseRate() != null && survey.getResponseRate() != 0.0) { + cleanedResponseRatesMap.put(surveyIndex, survey.getResponseRate()); + } + } + + // generate map for displaying access ways + List dataSets = dataSetRepository.findByDataPackageIdOrderByNumber(dataPackageId); + Map> accessWaysMap = generateAccessWaysMap(dataSets); + dataForTemplate.put("accessWaysMap", accessWaysMap); + + // generate quali and quanti datasets lists + generateSeperateDataSetLists(dataSets, surveys, dataForTemplate); + + String doi = + doiBuilder.buildDataPackageDoi(dataPackage, Release.builder().version(version).build()); + dataForTemplate.put("surveys", surveys); + dataForTemplate.put("surveyAnnotationsMapDe", surveyAnnotationsMapDe); + dataForTemplate.put("surveyAnnotationsMapEn", surveyAnnotationsMapEn); + dataForTemplate.put("surveySampleMapDe", surveySampleMapDe); + dataForTemplate.put("surveySampleMapEn", surveySampleMapEn); + dataForTemplate.put("surveyMethodMapDe", surveyMethodMapDe); + dataForTemplate.put("surveyMethodMapEn", surveyMethodMapEn); + dataForTemplate.put("populationDescriptionMapDe", populationDescriptionMapDe); + dataForTemplate.put("populationDescriptionMapEn", populationDescriptionMapEn); + dataForTemplate.put("surveyPeriodMap", surveyPeriodMap); + dataForTemplate.put("cleanedResponseRatesMap", cleanedResponseRatesMap); + dataForTemplate.put("numberOfObservationsMap", createNumberOfObservationsMap(dataSets)); + dataForTemplate.put("version", version); + dataForTemplate.put("baseUrl", baseUrl); + dataForTemplate.put("doi", doi); + + return dataForTemplate; + } + + private void generateSeperateDataSetLists(List dataSets, List surveys, + Map dataForTemplate) { + Map surveyMap = + surveys.stream().collect(Collectors.toMap(Survey::getId, Function.identity())); + List qualiDataSets = new ArrayList<>(); + List nonQualiDataSets = new ArrayList<>(); + for (DataSet dataSet : dataSets) { + boolean isQualiDataSet = true; + for (String surveyId : dataSet.getSurveyIds()) { + if (surveyMap.containsKey(surveyId)) { + if (surveyMap.get(surveyId).getDataType().equals(DataTypes.QUANTITATIVE_DATA)) { + isQualiDataSet = false; + } + } else { + isQualiDataSet = false; + } + } + if (isQualiDataSet) { + qualiDataSets.add(dataSet); + } else { + nonQualiDataSets.add(dataSet); + } + } + dataForTemplate.put("qualiDataSets", qualiDataSets); + dataForTemplate.put("nonQualiDataSets", nonQualiDataSets); + } + + private Map> generateAccessWaysMap(List dataSets) { + List accessWays = + dataSets.stream().map(DataSet::getSubDataSets).flatMap(Collection::stream) + .map(SubDataSet::getAccessWay).distinct().collect(Collectors.toList()); + accessWays.sort(Comparator.comparing(accessWay -> AccessWays.ALL.indexOf(accessWay))); + Map> accessWayMap = new LinkedHashMap<>(); + for (String accessWay : accessWays) { + String key = null; + if (accessWay.endsWith("cuf")) { + key = "CUF: "; + } + if (accessWay.endsWith("suf")) { + key = "SUF: "; + } + if (key != null) { + if (accessWayMap.containsKey(key)) { + accessWayMap.get(key).add(AccessWays.displayAccessWay(accessWay).replace(key, "")); + } else { + accessWayMap.put(key, + Lists.newArrayList(AccessWays.displayAccessWay(accessWay).replace(key, ""))); + } + } + } + return accessWayMap; + } + + @SuppressWarnings("unchecked") + private Map>>> createNumberOfObservationsMap( + List dataSets) { + Map>>> result = new HashMap<>(); + for (DataSet dataSet : dataSets) { + Map>> dataProductToAccessWayMap = new LinkedHashMap<>(); + result.put(dataSet.getNumber(), dataProductToAccessWayMap); + dataSet.getSubDataSets().sort( + Comparator.comparing(subDataSet -> AccessWays.ALL.indexOf(subDataSet.getAccessWay()))); + for (SubDataSet subDataSet : dataSet.getSubDataSets()) { + String key = null; + if (subDataSet.getAccessWay().endsWith("cuf")) { + key = "CUF: "; + } + if (subDataSet.getAccessWay().endsWith("suf")) { + key = "SUF: "; + } + if (key != null) { + if (dataProductToAccessWayMap.containsKey(key)) { + dataProductToAccessWayMap.get(key) + .add(new ImmutablePair( + AccessWays.displayAccessWay(subDataSet.getAccessWay()).replace(key, ""), + subDataSet.getNumberOfObservations())); + } else { + dataProductToAccessWayMap.put(key, + Lists.newArrayList(new ImmutablePair( + AccessWays.displayAccessWay(subDataSet.getAccessWay()).replace(key, ""), + subDataSet.getNumberOfObservations()))); + } + } + } + } + return result; + } + + private static void fillMap(Map> map, Integer surveyIndex, T baseObject, + Function i18nStringGetter, Function languageGetter) { + if (i18nStringGetter.apply(baseObject) != null + && !StringUtils.isEmpty(languageGetter.apply(i18nStringGetter.apply(baseObject)))) { + String property = languageGetter.apply(i18nStringGetter.apply(baseObject)); + if (map.containsKey(property)) { + map.get(property).add(surveyIndex); + } else { + map.put(property, Lists.newArrayList(surveyIndex)); + } + } + } + + private static void fillMap(Map> map, Integer surveyIndex, T baseObject, + Function periodGetter) { + if (periodGetter.apply(baseObject) != null) { + Period property = periodGetter.apply(baseObject); + if (map.containsKey(property)) { + map.get(property).add(surveyIndex); + } else { + map.put(property, Lists.newArrayList(surveyIndex)); + } + } + } + + @Override + protected List getSimpleTemplateFiles() { + return List.of("Main.tex"); + } + + @Override + protected List getComplexTemplateFiles() { + return new ArrayList<>(); + } +} diff --git a/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/repository/DataSetRepository.java b/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/repository/DataSetRepository.java index 0f2e36e54c..76e9df2344 100644 --- a/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/repository/DataSetRepository.java +++ b/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/repository/DataSetRepository.java @@ -90,4 +90,7 @@ Stream streamIdsByMasterIdInAndShadowIsTrueAndSuccessorI @RestResource(exported = false) Stream findByDataAcquisitionProjectIdAndShadowIsTrue(String dataAcquisitionProjectId); + + @RestResource(exported = false) + List findByDataPackageIdOrderByNumber(String dataPackageId); } diff --git a/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetReportResource.java b/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetReportResource.java index e1a76088d8..55ea38cd38 100644 --- a/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetReportResource.java +++ b/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/rest/DataSetReportResource.java @@ -5,18 +5,13 @@ import java.net.URI; import java.nio.file.Files; import java.nio.file.Path; -import java.util.Collection; import java.util.List; -import java.util.Optional; import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.ResponseEntity; import org.springframework.security.access.annotation.Secured; -import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; -import org.springframework.security.core.GrantedAuthority; -import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; @@ -25,6 +20,7 @@ import org.springframework.web.multipart.MultipartFile; import eu.dzhw.fdz.metadatamanagement.common.domain.Task; +import eu.dzhw.fdz.metadatamanagement.common.domain.Task.TaskType; import eu.dzhw.fdz.metadatamanagement.common.service.TaskManagementService; import eu.dzhw.fdz.metadatamanagement.datasetmanagement.domain.DataSet; import eu.dzhw.fdz.metadatamanagement.datasetmanagement.exception.TemplateIncompleteException; @@ -33,7 +29,7 @@ import eu.dzhw.fdz.metadatamanagement.mailmanagement.service.MailService; import eu.dzhw.fdz.metadatamanagement.usermanagement.domain.User; import eu.dzhw.fdz.metadatamanagement.usermanagement.security.AuthoritiesConstants; -import eu.dzhw.fdz.metadatamanagement.usermanagement.service.UserService; +import eu.dzhw.fdz.metadatamanagement.usermanagement.security.UserInformationProvider; import freemarker.template.TemplateException; import lombok.RequiredArgsConstructor; @@ -44,14 +40,13 @@ @RequestMapping("/api") @RequiredArgsConstructor public class DataSetReportResource { - private final DataSetReportService dataSetReportService; private final DataSetAttachmentService dataSetAttachmentService; private final MailService mailService; - private final UserService userService; + private final UserInformationProvider userInformationProvider; private final TaskManagementService taskService; @@ -74,8 +69,8 @@ public ResponseEntity startReportGeneration(@PathVariable("dataSetId") String @PathVariable("version") String version, HttpServletRequest request, @RequestParam(name = "languages", defaultValue = "de") List languages) throws IOException { - dataSetReportService.startDataSetReportTasks(dataSetId, version, languages, - request.getUserPrincipal().getName()); + taskService.startReportTasks(dataSetId, version, languages, + request.getUserPrincipal().getName(), TaskType.DATA_SET_REPORT); return ResponseEntity.ok().build(); } @@ -128,22 +123,10 @@ public ResponseEntity fillTemplate(@RequestParam("file") MultipartFile tem public ResponseEntity uploadReport(@RequestParam("file") MultipartFile reportFile, @PathVariable("dataSetId") String dataSetId, @RequestParam("onBehalfOf") String onBehalfOf, @PathVariable("language") String language) throws IOException { - Optional user = userService.getUserWithAuthoritiesByLogin(onBehalfOf); - if (user.isPresent()) { - User userInstance = user.get(); - // switch to on behalf user for correct modification names - Collection currentAuthorities = - SecurityContextHolder.getContext().getAuthentication().getAuthorities(); - UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken( - userInstance.getLogin(), userInstance.getPassword(), currentAuthorities); - SecurityContextHolder.getContext().setAuthentication(authentication); - dataSetAttachmentService.attachDataSetReport(dataSetId, language, reportFile); - mailService.sendDataSetReportGeneratedMail(user.get(), dataSetId, language, sender); - SecurityContextHolder.getContext().setAuthentication(null); - return ResponseEntity.ok().build(); - } else { - return ResponseEntity.badRequest() - .body("User with name '" + onBehalfOf + "' does not exist!"); - } + User user = userInformationProvider.switchToUser(onBehalfOf); + dataSetAttachmentService.attachDataSetReport(dataSetId, language, reportFile); + mailService.sendDataSetReportGeneratedMail(user, dataSetId, language, sender); + userInformationProvider.switchToUser(null); + return ResponseEntity.ok().build(); } } diff --git a/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetReportService.java b/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetReportService.java index d07ee194ca..3204f2930a 100644 --- a/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetReportService.java +++ b/src/main/java/eu/dzhw/fdz/metadatamanagement/datasetmanagement/service/DataSetReportService.java @@ -1,18 +1,10 @@ package eu.dzhw.fdz.metadatamanagement.datasetmanagement.service; -import java.io.File; -import java.io.FileInputStream; import java.io.IOException; -import java.io.StringWriter; -import java.io.Writer; -import java.net.URI; -import java.nio.charset.StandardCharsets; import java.nio.file.FileSystem; -import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; @@ -20,52 +12,30 @@ import java.util.Map; import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.loader.tools.RunProcess; -import org.springframework.core.env.Environment; -import org.springframework.core.env.Profiles; -import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; -import com.amazonaws.services.ecs.AmazonECS; -import com.amazonaws.services.ecs.model.ContainerOverride; -import com.amazonaws.services.ecs.model.DescribeServicesRequest; -import com.amazonaws.services.ecs.model.LaunchType; -import com.amazonaws.services.ecs.model.NetworkConfiguration; -import com.amazonaws.services.ecs.model.RunTaskRequest; -import com.amazonaws.services.ecs.model.TaskOverride; import com.google.common.collect.Maps; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; -import eu.dzhw.fdz.metadatamanagement.common.config.Constants; -import eu.dzhw.fdz.metadatamanagement.common.config.MetadataManagementProperties; -import eu.dzhw.fdz.metadatamanagement.common.config.MetadataManagementProperties.ReportTask; -import eu.dzhw.fdz.metadatamanagement.common.domain.Task; import eu.dzhw.fdz.metadatamanagement.common.rest.util.ZipUtil; +import eu.dzhw.fdz.metadatamanagement.common.service.AbstractReportService; import eu.dzhw.fdz.metadatamanagement.common.service.MarkdownHelper; import eu.dzhw.fdz.metadatamanagement.common.service.TaskManagementService; import eu.dzhw.fdz.metadatamanagement.datapackagemanagement.domain.DataPackage; import eu.dzhw.fdz.metadatamanagement.datapackagemanagement.repository.DataPackageRepository; import eu.dzhw.fdz.metadatamanagement.datasetmanagement.domain.DataSet; -import eu.dzhw.fdz.metadatamanagement.datasetmanagement.exception.TemplateIncompleteException; import eu.dzhw.fdz.metadatamanagement.datasetmanagement.repository.DataSetRepository; import eu.dzhw.fdz.metadatamanagement.filemanagement.service.FileService; import eu.dzhw.fdz.metadatamanagement.instrumentmanagement.domain.Instrument; import eu.dzhw.fdz.metadatamanagement.instrumentmanagement.repository.InstrumentRepository; import eu.dzhw.fdz.metadatamanagement.questionmanagement.domain.Question; import eu.dzhw.fdz.metadatamanagement.questionmanagement.repository.QuestionRepository; -import eu.dzhw.fdz.metadatamanagement.variablemanagement.domain.AccessWays; import eu.dzhw.fdz.metadatamanagement.variablemanagement.domain.RelatedQuestion; import eu.dzhw.fdz.metadatamanagement.variablemanagement.domain.ValidResponse; import eu.dzhw.fdz.metadatamanagement.variablemanagement.domain.Variable; import eu.dzhw.fdz.metadatamanagement.variablemanagement.domain.projections.VariableSubDocumentProjection; import eu.dzhw.fdz.metadatamanagement.variablemanagement.repository.VariableRepository; import freemarker.template.Configuration; -import freemarker.template.Template; import freemarker.template.TemplateException; -import freemarker.template.TemplateExceptionHandler; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; /** * This service fills tex templates with data and put it into the gridfs / mongodb. @@ -73,13 +43,7 @@ * @author Daniel Katzberg */ @Service -@Slf4j -@RequiredArgsConstructor -public class DataSetReportService { - private static final String TASK_TYPE = "DATASET_REPORT"; - - private final FileService fileService; - +public class DataSetReportService extends AbstractReportService { private final DataSetRepository dataSetRepository; private final VariableRepository variableRepository; @@ -90,242 +54,23 @@ public class DataSetReportService { private final InstrumentRepository instrumentRepository; - private final TaskManagementService taskService; - - private final Environment environment; - - private final MetadataManagementProperties metadataManagementProperties; - - private final MarkdownHelper markdownHelper; - - @Autowired(required = false) - private AmazonECS ecsClient; - - /** - * The Escape Prefix handles the escaping of special latex signs within data information. This - * Prefix will be copied before the template source code. - */ - private static final String ESCAPE_PREFIX = - "<#escape x as x?replace(\"\\\\\", \"\\\\textbackslash{}\")" - + "?replace(\"{\", \"\\\\{\")?replace(\"}\", \"\\\\}\")" - + "?replace(\"#\", \"\\\\#\")?replace(\"$\", \"\\\\$\")" - + "?replace(\"%\", \"\\\\%\")?replace(\"&\", \"\\\\&\")" - + "?replace(\"^\", \"\\\\textasciicircum{}\")?replace(\"_\", \"\\\\_\")" - + "?replace(\">\", \"\\\\textgreater{}\")?replace(\"<\", \"\\\\textless{}\")" - + "?replace(\"~\", \"\\\\textasciitilde{}\")" + "?replace(\"\\r\\n\", \"\\\\par \")" - + "?replace(\"\\n\", \"\\\\par \")>"; - - /** - * The Escape Suffix closes the escaping prefix. This Prefix will be copied after the template - * source code. - */ - private static final String ESCAPE_SUFFIX = ""; - - - /** - * Zip Mime Content Type. - */ - private static final String CONTENT_TYPE_ZIP = "application/zip"; - - /** - * Files which will be filled by the freemarker code. - */ - private static final String KEY_VARIABLELIST = "Variablelist.tex"; - private static final String KEY_MAIN = "Main.tex"; - private static final String KEY_VARIABLE = "variables/Variable.tex"; - - /** - * This service method will receive a tex template as a string and an id of a data set. With this - * id, the service will load the data set for receiving all depending information, which are - * needed for filling of the tex template with data. - * - * @param zipTmpFilePath The path to uploaded zip file - * @param originalName the original name of multipartfile - * @param dataSetId An id of the data set. - * @param task the task to update the status of the pro - * @param version The version of the report as it is displayed in the title. - * - * @throws TemplateException Handles templates exceptions. - * @throws IOException Handles IO Exception for the template. - */ - @Async - public void generateReport(Path zipTmpFilePath, String originalName, String dataSetId, Task task, - String version) { - log.debug("Start generating report for {} and datasetId {}", originalName, dataSetId); - try { - // Configuration, based on Freemarker Version 2.3.23 - Configuration templateConfiguration = new Configuration(Configuration.VERSION_2_3_23); - templateConfiguration.setDefaultEncoding(StandardCharsets.UTF_8.toString()); - templateConfiguration.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); - templateConfiguration.setNumberFormat("0.######"); - log.debug("Prepare Zip enviroment config"); - // Prepare Zip enviroment config - Map env = new HashMap<>(); - env.put("create", "true"); - env.put("encoding", StandardCharsets.UTF_8.name()); - // Create tmp file - URI uriOfZipFile = URI.create("jar:" + zipTmpFilePath.toUri()); - try (FileSystem zipFileSystem = FileSystems.newFileSystem(uriOfZipFile, env);) { - // Check missing files. - log.debug("Check missing files."); - List missingTexFiles = this.validateDataSetReportStructure(zipFileSystem); - if (!missingTexFiles.isEmpty()) { - String message = "data-set-management.error" + ".files-in-template-zip-incomplete"; - TemplateIncompleteException incompleteException = - new TemplateIncompleteException(message, missingTexFiles); - log.debug(message + missingTexFiles); - task = taskService.handleErrorTask(task, incompleteException); - return; - } - log.debug("Read the three files with freemarker code"); - // Read the three files with freemarker code - Path pathToMainTexFile = zipFileSystem.getPath(KEY_MAIN); - String texMainFileStr = ZipUtil.readFileFromZip(pathToMainTexFile); - Path pathToVariableListTexFile = zipFileSystem.getPath(KEY_VARIABLELIST); - String texVariableListFileStr = ZipUtil.readFileFromZip(pathToVariableListTexFile); - Path pathToVariableTexFile = zipFileSystem.getPath(KEY_VARIABLE); - String texVariableFileStr = ZipUtil.readFileFromZip(pathToVariableTexFile); - - // Load data for template only once - Map dataForTemplate = this.loadDataForTemplateFilling(dataSetId, version); - - dataForTemplate.put("removeMarkdown", markdownHelper.createRemoveMarkdownMethod()); - dataForTemplate.put("displayAccessWay", AccessWays.createDisplayAccessWayMethod()); - try { - String variableListFilledStr = this.fillTemplate(texVariableListFileStr, - templateConfiguration, dataForTemplate, KEY_VARIABLELIST); - ZipUtil.writeFileToZip(pathToVariableListTexFile, variableListFilledStr); - String mainFilledStr = - this.fillTemplate(texMainFileStr, templateConfiguration, dataForTemplate, KEY_MAIN); - ZipUtil.writeFileToZip(pathToMainTexFile, mainFilledStr); - } catch (TemplateException e) { - log.debug("fill template fails", e); - task = taskService.handleErrorTask(task, e); - return; - } - // Create Variables pages - @SuppressWarnings("unchecked") - Map variablesMap = - (Map) dataForTemplate.get("variables"); - Collection variables = variablesMap.values(); - - for (Variable variable : variables) { - // filledTemplates.put("variables/" + variable.getName() + ".tex", - try { - dataForTemplate.put("variable", variable); - String filledVariablesFile = fillTemplate(texVariableFileStr, templateConfiguration, - dataForTemplate, KEY_VARIABLE); - Path pathOfVariable = Paths.get("variables/" + variable.getName() + ".tex"); - final Path root = zipFileSystem.getPath("/"); - final Path dest = zipFileSystem.getPath(root.toString(), pathOfVariable.toString()); - ZipUtil.writeFileToZip(dest, filledVariablesFile); - } catch (TemplateException te) { - log.debug("templage invalid", te); - task = taskService.handleErrorTask(task, te); - return; - } - } - - // Delete Variables.tex file from zip - Files.delete(pathToVariableTexFile); - } - - // Save into MongoDB / GridFS - File zipTmpFile = zipTmpFilePath.toFile(); - String fileName = this.saveCompleteZipFile(zipTmpFile, originalName); - log.debug("file saved, start #handletaskDone"); - taskService.handleTaskDone(task, fileName); - } catch (IOException e) { - log.error("failed generating report", e); - taskService.handleErrorTask(task, e); - } - } - - /** - * Checks for all files which are included for the tex template. - * - * @param zipFileSystem The zip file as file system - * @return True if all files are included. False min one file is missing. - */ - private List validateDataSetReportStructure(FileSystem zipFileSystem) { - List missingTexFiles = new ArrayList<>(); - - // NO Check for References.bib. This file is just optional has has to be added manually. - - Path mainFile = zipFileSystem.getPath(zipFileSystem.getPath("/").toString(), KEY_MAIN); - if (!Files.exists(mainFile)) { - missingTexFiles.add(KEY_MAIN); - } - - Path variableFile = zipFileSystem.getPath(zipFileSystem.getPath("/").toString(), KEY_VARIABLE); - if (!Files.exists(variableFile)) { - missingTexFiles.add(KEY_VARIABLE); - } - - Path variableListFile = - zipFileSystem.getPath(zipFileSystem.getPath("/").toString(), KEY_VARIABLELIST); - if (!Files.exists(variableListFile)) { - missingTexFiles.add(KEY_VARIABLELIST); - } - - return missingTexFiles; - } - - - - /** - * This method fills the tex templates. - * - * @param templateContent The content of a tex template. - * @param templateConfiguration The configuration for freemarker. - * @param fileName filename of the script which will be filled in this method. - * @return The filled tex templates as byte array. - * @throws IOException Handles IO Exception. - * @throws TemplateException Handles template Exceptions. - */ - private String fillTemplate(String templateContent, Configuration templateConfiguration, - Map dataForTemplate, String fileName) throws IOException, TemplateException { - String templateName = "texTemplate"; - if (fileName != null && fileName.trim().length() > 0) { - templateName = fileName; - } - - // Read Template and escape elements - Template texTemplate = new Template(templateName, - ESCAPE_PREFIX + templateContent + ESCAPE_SUFFIX, templateConfiguration); - - try (Writer stringWriter = new StringWriter()) { - texTemplate.process(dataForTemplate, stringWriter); - - stringWriter.flush(); - return stringWriter.toString(); - } - } - /** - * This method save a latex file into GridFS/MongoDB based on a byteArrayOutputStream. - * - * @param fileName The name of the file to be saved - * @return return the file name of the saved latex template in the GridFS / MongoDB. - * @throws IOException thrown if a stream cannot be closed + * Instantiate and autowire the service. */ - @SuppressFBWarnings("OBL_UNSATISFIED_OBLIGATION") - private String saveCompleteZipFile(File zipFile, String fileName) throws IOException { - // No Update by API, so we have to delete first. - fileService.deleteTempFile(fileName); - // Save tex file - return fileService.saveTempFile(new FileInputStream(zipFile), fileName, CONTENT_TYPE_ZIP); + public DataSetReportService(FileService fileService, TaskManagementService taskService, + MarkdownHelper markdownHelper, DataSetRepository dataSetRepository, + VariableRepository variableRepository, QuestionRepository questionRepository, + DataPackageRepository dataPackageRepository, InstrumentRepository instrumentRepository) { + super(fileService, taskService, markdownHelper); + this.dataSetRepository = dataSetRepository; + this.variableRepository = variableRepository; + this.questionRepository = questionRepository; + this.dataPackageRepository = dataPackageRepository; + this.instrumentRepository = instrumentRepository; } - /** - * This method load all needed objects from the db for filling the tex template. - * - * @param dataSetId the id of the dataset. - * @param version The version of the report as it is displayed in the title. - * @return A HashMap with all data for the template filling. The Key is the name of the Object, - * which is used in the template. - */ - private Map loadDataForTemplateFilling(String dataSetId, String version) { + @Override + protected Map loadDataForTemplateFilling(String dataSetId, String version) { // Create Map for the template Map dataForTemplate = new HashMap<>(); @@ -397,8 +142,7 @@ private Map createVariableDependingMaps(Map data Map instrumentMap = new HashMap<>(); Map> firstTenValidResponses = new HashMap<>(); Map> lastTenValidResponses = new HashMap<>(); - Map> repeatedMeasurementVariables = - new HashMap<>(); + Map> repeatedMeasurementVariables = new HashMap<>(); Map> derivedVariables = new HashMap<>(); for (Variable variable : variables) { @@ -465,48 +209,36 @@ private Map createVariableDependingMaps(Map data } - /** - * Start one container per language which builds the report. Either via aws fargate or locally via - * docker. - * - * @param dataSetId The id of the dataSet for which the report will be generated. - * @param languages The languages in which we need to generate the report. Currently supported - * 'de', 'en'. - * @param version The version of the dataset report. - * @param onBehalfOf The name of the user which wants to generate the report. - * @throws IOException in case the local task cannot be started - */ - public void startDataSetReportTasks(String dataSetId, String version, List languages, - String onBehalfOf) throws IOException { - for (String language : languages) { - if (environment.acceptsProfiles(Profiles.of(Constants.SPRING_PROFILE_LOCAL))) { - log.debug("Starting docker container from image report-task..."); - RunProcess dataSetReportTaskContainer = - new RunProcess("src/main/resources/bin/run-report-task.sh", dataSetId, version, - language, onBehalfOf, TASK_TYPE); - dataSetReportTaskContainer.run(false); - } else { - ReportTask taskProperties = metadataManagementProperties.getReportTask(); - log.info("Starting fargate task {}...", taskProperties.getTaskDefinition()); - NetworkConfiguration networkConfiguration = ecsClient - .describeServices( - new DescribeServicesRequest().withCluster(taskProperties.getClusterName()) - .withServices(taskProperties.getServiceName())) - .getServices().get(0).getNetworkConfiguration(); - - RunTaskRequest req = - new RunTaskRequest().withTaskDefinition(taskProperties.getTaskDefinition()) - .withNetworkConfiguration(networkConfiguration) - .withCluster(taskProperties.getClusterName()).withLaunchType(LaunchType.FARGATE) - .withCount( - 1) - .withStartedBy(onBehalfOf) - .withOverrides(new TaskOverride().withContainerOverrides( - new ContainerOverride().withName(taskProperties.getContainerName()) - .withCommand(String.format(taskProperties.getStartCommand(), dataSetId, - version, language, onBehalfOf, TASK_TYPE).split("\\s+")))); - ecsClient.runTask(req); - } + @Override + protected List getSimpleTemplateFiles() { + return List.of("Main.tex", "Variablelist.tex"); + } + + @Override + protected List getComplexTemplateFiles() { + return List.of("variables/Variable.tex"); + } + + @Override + protected void handleComplexTemplateFile(String templateFilename, FileSystem zipFileSystem, + Map dataForTemplate, Configuration templateConfiguration) + throws IOException, TemplateException { + @SuppressWarnings("unchecked") + Map variablesMap = (Map) dataForTemplate.get("variables"); + Collection variables = variablesMap.values(); + String template = ZipUtil.readFileFromZip(zipFileSystem.getPath(templateFilename)); + + for (Variable variable : variables) { + dataForTemplate.put("variable", variable); + String filledVariablesFile = + fillTemplate(template, templateConfiguration, dataForTemplate, templateFilename); + Path pathOfVariable = Paths.get("variables/" + variable.getName() + ".tex"); + final Path root = zipFileSystem.getPath("/"); + final Path dest = zipFileSystem.getPath(root.toString(), pathOfVariable.toString()); + ZipUtil.writeFileToZip(dest, filledVariablesFile); } + + // Delete Variables.tex file from zip + Files.delete(zipFileSystem.getPath(templateFilename)); } } diff --git a/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java b/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java index b3a3f0a3b9..6fbfb307a1 100644 --- a/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java +++ b/src/main/java/eu/dzhw/fdz/metadatamanagement/mailmanagement/service/MailService.java @@ -361,4 +361,59 @@ public void sendMailOnNewMajorProjectRelease(List releaseManagers, sendEmail(null, emailAddresses.toArray(new String[emailAddresses.size()]), null, null, subject, content, false, true); } + + /** + * Send the result of the data package overview generation to the user who has started the + * overview generation. + * + * @param user The user who has started the overview generation. + * @param dataPackageId The id of the {@link DataPackage} for which the overview has been + * generated. + * @param language The language in which the report has been generated. + * @param sender The sender of the email. + */ + @Async + public void sendDataPackageOverviewGeneratedMail(User user, String dataPackageId, String language, + String sender) { + log.debug("Sending 'data package overview generated' mail"); + Locale locale = Locale.forLanguageTag(user.getLangKey()); + Context context = new Context(locale); + context.setVariable("user", user); + context.setVariable("dataPackageId", dataPackageId); + context.setVariable("locale", locale); + context.setVariable("language", language); + context.setVariable("baseUrl", baseUrl); + String content = templateEngine.process("dataPackageOverviewGeneratedEmail", context); + String subject = messageSource.getMessage("email.datapackage-overview-generated.title", + new Object[] {dataPackageId, language}, locale); + sendEmail(sender, new String[] {user.getEmail()}, null, null, subject, content, false, true); + } + + /** + * Send the error during data package overview generation to the user who started the task and to + * all admins. + * + * @param onBehalfUser The user who has started the report generation. + * @param admins A list of admins. + * @param sender The sender of the email. + */ + @Async + public void sendDataPackageOverviewErrorMail(User onBehalfUser, List admins, + TaskErrorNotification errorNotification, String sender) { + log.debug("Sending 'datapackage overview error' mail"); + Locale locale = Locale.forLanguageTag(onBehalfUser.getLangKey()); + Context context = new Context(locale); + context.setVariable("onBehalfUser", onBehalfUser); + context.setVariable("taskErrorNotification", errorNotification); + context.setVariable("locale", locale); + context.setVariable("baseUrl", baseUrl); + String content = templateEngine.process("dataPackageOverviewErrorEmail", context); + String subject = messageSource.getMessage("email.datapackage-overview-error.title", + new Object[] {errorNotification.getDomainObjectId()}, locale); + List adminAddresses = admins.stream().map(User::getEmail).collect(Collectors.toList()); + sendEmail(sender, new String[] {onBehalfUser.getEmail()}, + adminAddresses.toArray(new String[adminAddresses.size()]), null, subject, content, false, + true); + + } } diff --git a/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/service/ShadowCopyQueueItemService.java b/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/service/ShadowCopyQueueItemService.java index 83ebc0f31c..c130a47dde 100644 --- a/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/service/ShadowCopyQueueItemService.java +++ b/src/main/java/eu/dzhw/fdz/metadatamanagement/projectmanagement/service/ShadowCopyQueueItemService.java @@ -7,11 +7,6 @@ import org.springframework.context.ApplicationEventPublisher; import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.security.core.userdetails.UserDetails; -import org.springframework.security.core.userdetails.UserDetailsService; -import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Service; import eu.dzhw.fdz.metadatamanagement.projectmanagement.domain.DataAcquisitionProject; @@ -22,6 +17,7 @@ import eu.dzhw.fdz.metadatamanagement.projectmanagement.repository.ShadowCopyQueueItemRepository; import eu.dzhw.fdz.metadatamanagement.searchmanagement.service.ElasticsearchUpdateQueueService; import eu.dzhw.fdz.metadatamanagement.usermanagement.security.SecurityUtils; +import eu.dzhw.fdz.metadatamanagement.usermanagement.security.UserInformationProvider; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -47,7 +43,7 @@ public class ShadowCopyQueueItemService { private final ElasticsearchUpdateQueueService elasticsearchUpdateQueueService; - private final UserDetailsService userDetailsService; + private final UserInformationProvider userInformationProvider; /** * Create a new shadow copy queue item. @@ -177,19 +173,16 @@ public void executeShadowCopyActions() { private void emitShadowCopyingEndedEvent(DataAcquisitionProject dataAcquisitionProject, Release release, String previousReleaseVersion, boolean isRerelease, Action action) { - this.applicationEventPublisher.publishEvent(new ShadowCopyingEndedEvent(this, - dataAcquisitionProject.getMasterId(), release, previousReleaseVersion, isRerelease, - action)); + this.applicationEventPublisher + .publishEvent(new ShadowCopyingEndedEvent(this, dataAcquisitionProject.getMasterId(), + release, previousReleaseVersion, isRerelease, action)); } private void setupSecurityContext(ShadowCopyQueueItem shadowCopyQueueItem) { String username = shadowCopyQueueItem.getCreatedBy(); try { - UserDetails userDetails = userDetailsService.loadUserByUsername(username); - UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken( - userDetails.getUsername(), userDetails.getPassword(), userDetails.getAuthorities()); - SecurityContextHolder.getContext().setAuthentication(token); - } catch (UsernameNotFoundException e) { + userInformationProvider.switchToUser(username); + } catch (IllegalArgumentException e) { throw new IllegalStateException("User " + username + " created a shadow copy task for " + "project " + shadowCopyQueueItem.getDataAcquisitionProjectId() + ", but this user " + "could not be found!", e); @@ -197,7 +190,7 @@ private void setupSecurityContext(ShadowCopyQueueItem shadowCopyQueueItem) { } private void clearSecurityContext() { - SecurityContextHolder.getContext().setAuthentication(null); + userInformationProvider.switchToUser(null); } private String getPreviousReleaseVersion(DataAcquisitionProject dataAcquisitionProject, diff --git a/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/repository/SurveyRepository.java b/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/repository/SurveyRepository.java index 113ae46359..4642beed25 100644 --- a/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/repository/SurveyRepository.java +++ b/src/main/java/eu/dzhw/fdz/metadatamanagement/surveymanagement/repository/SurveyRepository.java @@ -79,7 +79,10 @@ Stream streamIdsByMasterIdInAndShadowIsTrueAndSuccessorI @RestResource(exported = false) Stream findByDataAcquisitionProjectIdAndShadowIsTrue(String dataAcquisitionProjectId); - + @RestResource(exported = false) Stream findByMasterIdAndShadowIsTrue(String masterId); + + @RestResource(exported = false) + List findByDataPackageIdOrderBySerialNumberAscNumberAsc(String dataAcquisitionProjectId); } diff --git a/src/main/java/eu/dzhw/fdz/metadatamanagement/usermanagement/security/UserInformationProvider.java b/src/main/java/eu/dzhw/fdz/metadatamanagement/usermanagement/security/UserInformationProvider.java index 9653cf7a12..d4ef2f12d0 100644 --- a/src/main/java/eu/dzhw/fdz/metadatamanagement/usermanagement/security/UserInformationProvider.java +++ b/src/main/java/eu/dzhw/fdz/metadatamanagement/usermanagement/security/UserInformationProvider.java @@ -2,6 +2,8 @@ import javax.validation.constraints.NotEmpty; +import eu.dzhw.fdz.metadatamanagement.usermanagement.domain.User; + /** * Provides login name and role checks of the currently authenticated user. */ @@ -20,4 +22,12 @@ public interface UserInformationProvider { * Checks if the currently authenticated user has been authenticated anonymously. */ boolean isUserAnonymous(); + + /** + * Switches the security context to the given user or logs the current user out. + * + * @param login the username to login, if null the security context will be cleared + * @return the user information of the logged in user + */ + User switchToUser(String login); } diff --git a/src/main/java/eu/dzhw/fdz/metadatamanagement/usermanagement/security/UserInformationProviderImpl.java b/src/main/java/eu/dzhw/fdz/metadatamanagement/usermanagement/security/UserInformationProviderImpl.java index a2c85d8355..63375f3908 100644 --- a/src/main/java/eu/dzhw/fdz/metadatamanagement/usermanagement/security/UserInformationProviderImpl.java +++ b/src/main/java/eu/dzhw/fdz/metadatamanagement/usermanagement/security/UserInformationProviderImpl.java @@ -1,15 +1,30 @@ package eu.dzhw.fdz.metadatamanagement.usermanagement.security; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + import javax.validation.constraints.NotEmpty; +import org.apache.commons.lang3.StringUtils; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Service; +import eu.dzhw.fdz.metadatamanagement.usermanagement.domain.User; +import eu.dzhw.fdz.metadatamanagement.usermanagement.service.UserService; +import lombok.RequiredArgsConstructor; + /** * Implementation for {@link UserInformationProvider}. */ @Service +@RequiredArgsConstructor class UserInformationProviderImpl implements UserInformationProvider { - + private final UserService userService; + @Override public String getUserLogin() { return SecurityUtils.getCurrentUserLogin(); @@ -24,4 +39,26 @@ public boolean isUserInRole(@NotEmpty String role) { public boolean isUserAnonymous() { return SecurityUtils.isUserAnonymous(); } + + @Override + public User switchToUser(String login) { + if (StringUtils.isEmpty(login)) { + SecurityContextHolder.getContext().setAuthentication(null); + return null; + } + Optional user = userService.getUserWithAuthoritiesByLogin(login); + if (user.isPresent()) { + User userInstance = user.get(); + // switch to on behalf user for correct modification names + Set grantedAuthorities = userInstance.getAuthorities().stream() + .map(authority -> new SimpleGrantedAuthority(authority.getName())) + .collect(Collectors.toSet()); + UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken( + userInstance.getLogin(), userInstance.getPassword(), grantedAuthorities); + SecurityContextHolder.getContext().setAuthentication(authentication); + return userInstance; + } else { + throw new IllegalArgumentException("User not found: " + login); + } + } } diff --git a/src/main/resources/i18n/messages_de.properties b/src/main/resources/i18n/messages_de.properties index 2cdb2ff6e3..2ce62dfad9 100644 --- a/src/main/resources/i18n/messages_de.properties +++ b/src/main/resources/i18n/messages_de.properties @@ -63,9 +63,21 @@ email.dataset-report-generated.greeting=Liebe(r) {0}, email.dataset-report-generated.text=Ihr Datensatzreport in Sprache "{0}" wurde erfolgreich erzeugt und kann, wenn Sie angemeldet sind, hier betrachtet werden: email.dataset-report-generated.link=Datensatzdetails zu "{0}" im MDM +email.datapackage-overview-generated.title=Übersicht zu Datenpaket "{0}" in Sprache "{1}" erfolgreich erzeugt +email.datapackage-overview-generated.greeting=Liebe(r) {0}, +email.datapackage-overview-generated.text=Ihre Datenpaketübersicht in Sprache "{0}" wurde erfolgreich erzeugt und kann, wenn Sie angemeldet sind, hier betrachtet werden: +email.datapackage-overview-generated.link=Datenpaketdetails zu "{0}" im MDM + email.dataset-report-error.title=Fehler beim Erzeugen des Datensatzreports zu Datensatz "{0}" email.dataset-report-error.greeting=Liebe(r) {0}, email.dataset-report-error.starttext=beim Erzeugen Ihres Datensatzreports zu email.dataset-report-error.link=Datensatz "{0}" email.dataset-report-error.endtext=ist folgender Fehler aufgetreten: email.dataset-report-error.admintext=Die Administrator:innen des MDM wurden ebenfalls benachrichtigt und werden Sie ggf. kontaktieren. + +email.datapackage-overview-error.title=Fehler beim Erzeugen der Übersicht zu Datensatz "{0}" +email.datapackage-overview-error.greeting=Liebe(r) {0}, +email.datapackage-overview-error.starttext=beim Erzeugen Ihrer Übersicht zu +email.datapackage-overview-error.link=Datenpaket "{0}" +email.datapackage-overview-error.endtext=ist folgender Fehler aufgetreten: +email.datapackage-overview-error.admintext=Die Administrator:innen des MDM wurden ebenfalls benachrichtigt und werden Sie ggf. kontaktieren. diff --git a/src/main/resources/i18n/messages_en.properties b/src/main/resources/i18n/messages_en.properties index 615a397df0..ba64776b3f 100644 --- a/src/main/resources/i18n/messages_en.properties +++ b/src/main/resources/i18n/messages_en.properties @@ -63,9 +63,21 @@ email.dataset-report-generated.greeting=Dear {0}, email.dataset-report-generated.text=Your dataset report was successfully generated in language "{0}" and can be viewed here if you are logged in: email.dataset-report-generated.link=Dataset "{0}" in the MDM +email.datapackage-overview-generated.title=Overview for Data Package "{0}" in language "{1}" generated successfully +email.datapackage-overview-generated.greeting=Dear {0}, +email.datapackage-overview-generated.text=Your data package overview was successfully generated in language "{0}" and can be viewed here if you are logged in: +email.datapackage-overview-generated.link=Data Package "{0}" in the MDM + email.dataset-report-error.title=Error when generating report for Dataset "{0}" email.dataset-report-error.greeting=Dear {0}, email.dataset-report-error.starttext=the following error occurred when creating your report for email.dataset-report-error.link=Dataset "{0}" email.dataset-report-error.endtext=: email.dataset-report-error.admintext=The administrators of the MDM have also been notified and will contact you if necessary. + +email.datapackage-overview-error.title=Error when generating overview for Data Package "{0}" +email.datapackage-overview-error.greeting=Dear {0}, +email.datapackage-overview-error.starttext=the following error occurred when creating your overview for +email.datapackage-overview-error.link=Data Package "{0}" +email.datapackage-overview-error.endtext=: +email.datapackage-overview-error.admintext=The administrators of the MDM have also been notified and will contact you if necessary. diff --git a/src/main/resources/mails/dataPackageOverviewErrorEmail.html b/src/main/resources/mails/dataPackageOverviewErrorEmail.html new file mode 100644 index 0000000000..f668f46e70 --- /dev/null +++ b/src/main/resources/mails/dataPackageOverviewErrorEmail.html @@ -0,0 +1,40 @@ + + + +Fehler beim Erzeugen der Übersicht + zu Datenpaket + + + + +

Liebe(r) rreitmann,

+ + beim Erzeugen Ihrer Datenpaketübersicht zu + + Datenpaket + im MDM + ist folgender Fehler aufgetreten: +
+		Fehlernachricht
+	
+

+ Die Administrator:innen des MDM wurden ebenfalls benachrichtigt und werden Sie ggf. kontaktieren. +

+

+ Grüße,
Ihr FDZ-Team +

+ + diff --git a/src/main/resources/mails/dataPackageOverviewGeneratedEmail.html b/src/main/resources/mails/dataPackageOverviewGeneratedEmail.html new file mode 100644 index 0000000000..c8679b83ff --- /dev/null +++ b/src/main/resources/mails/dataPackageOverviewGeneratedEmail.html @@ -0,0 +1,37 @@ + + + +Datenpaketübersicht + zu Datenpaket erfolgreich erzeugt + + + + +

+ Liebe(r) rreitmann,

+

+ Ihr + Datensatzreport wurde erfolgreich erzeugt und kann, wenn Sie + angemeldet sind, hier betrachted werden: +
+ Datenpaketdetails + im MDM +

+

+ Grüße,
Ihr FDZ-Team +

+ + diff --git a/src/main/webapp/index.html b/src/main/webapp/index.html index e939639027..be6e2591cc 100644 --- a/src/main/webapp/index.html +++ b/src/main/webapp/index.html @@ -382,6 +382,7 @@ + @@ -445,6 +446,7 @@ + @@ -454,6 +456,7 @@ + diff --git a/src/main/webapp/scripts/app.constants.js b/src/main/webapp/scripts/app.constants.js index 3aa4820a0f..da7bcfff5c 100644 --- a/src/main/webapp/scripts/app.constants.js +++ b/src/main/webapp/scripts/app.constants.js @@ -6,7 +6,7 @@ angular.module('metadatamanagementApp') .constant('ENV', 'local') -.constant('VERSION', '1.0.111-HOTFIX') +.constant('VERSION', '1.0.112') .constant('ElasticSearchProperties', {apiVersion:'7.x',logLevel:'error',pageSize:10}) diff --git a/src/main/webapp/scripts/datapackagemanagement/configuration/translations-de.js b/src/main/webapp/scripts/datapackagemanagement/configuration/translations-de.js index 5f10440adf..608b00f737 100644 --- a/src/main/webapp/scripts/datapackagemanagement/configuration/translations-de.js +++ b/src/main/webapp/scripts/datapackagemanagement/configuration/translations-de.js @@ -116,8 +116,10 @@ angular.module('metadatamanagementApp').config( 'many': 'Klicken, um alle Konzepte, die in diesem Datenpaket gemessen wurden, anzuzeigen' } }, - 'doi-tooltip': 'Klicken, um die DOI in einem neuen Tab zu öffnen', - 'tag-tooltip': 'Klicken, um Datenpakete mit diesem Tag zu suchen' + 'doi-tooltip': 'Klicken, um die DOI in einem neuen Tab zu öffnen.', + 'tag-tooltip': 'Klicken, um Datenpakete mit diesem Tag zu suchen.', + 'generate-datapackage-overview-tooltip': 'Klicken, um eine Übersicht über dieses Datenpaket als PDF zu erstellen.', + 'overview-generation-started-toast': 'Die Datenpaketübersicht wird jetzt erzeugt. Sie werden per E-Mail benachrichtigt, sobald der Vorgang abgeschlossen ist.' }, 'log-messages': { 'data-package': { @@ -307,6 +309,32 @@ angular.module('metadatamanagementApp').config( 'error': { 'required': 'Es muss mindestens ein Tag eingetragen sein.' } + }, + 'create-overview': { + 'title': 'Datenpaketübersicht erzeugen', + 'version': 'Version des Datenpakets', + 'languages': { + 'in-german': 'Deutsch', + 'in-english': 'Englisch' + }, + 'error': { + 'version': { + 'not-empty': 'Die Version darf nicht leer sein.', + 'pattern': 'Die Version muss von der Form "major.minor.patch" (z.B. "1.0.0") sein.', + 'size': 'Die Version darf nicht länger als 32 Zeichen sein.' + }, + 'languages': { + 'not-empty': 'Sie müssen mindestens eine Sprache auswählen!', + } + }, + 'hints': { + 'version': 'Geben Sie die Versionsnummer an, die für die Anzeige der DOI des Datenpakets verwendet werden soll.', + 'languages': 'Wählen Sie mindestens eine Sprache aus, in der die Übersicht erzeugt werden soll.' + }, + 'tooltip': { + 'cancel': 'Klicken, um das Erzeugen der Datenpaketübersicht abzubrechen.', + 'ok': 'Klicken, um das Erzeugen der Datenpaketübersicht zu starten.' + } } } //jscs:enable diff --git a/src/main/webapp/scripts/datapackagemanagement/configuration/translations-en.js b/src/main/webapp/scripts/datapackagemanagement/configuration/translations-en.js index 124168dc97..b2d913465f 100644 --- a/src/main/webapp/scripts/datapackagemanagement/configuration/translations-en.js +++ b/src/main/webapp/scripts/datapackagemanagement/configuration/translations-en.js @@ -117,7 +117,9 @@ angular.module('metadatamanagementApp').config( } }, 'doi-tooltip': 'Click to open the DOI in a new Tab', - 'tag-tooltip': 'Click to search for data packages with this tag' + 'tag-tooltip': 'Click to search for data packages with this tag', + 'generate-datapackage-overview-tooltip': 'Click to generate an overview of this data package as a PDF.', + 'overview-generation-started-toast': 'The data package overview is now being generated. You will be notified by e-mail as soon as the process is completed.' }, 'log-messages': { 'data-package': { @@ -305,6 +307,29 @@ angular.module('metadatamanagementApp').config( 'error': { 'required': 'At least one tag must be provided' } + }, + 'create-overview': { + 'title': 'Generate Data Package Overview', + 'version': 'Version of the overview', + 'languages': { + 'in-german': 'German', + 'in-english': 'English' + }, + 'error': { + 'version': { + 'not-empty': 'The version must not be empty.', + 'pattern': 'The version must match the pattern "major.minor.patch" (e.g. "1.0.0").', + 'size': 'The version must not contain more than 32 characters.' + } + }, + 'hints': { + 'version': 'Specify the version number which will be used to display the DOI of the data package.', + 'languages': 'Specify at least one language in which the overview shall be generated.' + }, + 'tooltip': { + 'cancel': 'Click to cancel the generation of the overview', + 'ok': 'Click to start the generation of the overview' + } } } //jscs:enable diff --git a/src/main/webapp/scripts/datapackagemanagement/resources/dataPackageOverview.resource.js b/src/main/webapp/scripts/datapackagemanagement/resources/dataPackageOverview.resource.js new file mode 100644 index 0000000000..9795e2ad37 --- /dev/null +++ b/src/main/webapp/scripts/datapackagemanagement/resources/dataPackageOverview.resource.js @@ -0,0 +1,15 @@ +'use strict'; + +angular.module('metadatamanagementApp') + .factory('DataPackageOverviewResource', function($resource) { + return $resource( + 'api/data-packages/:dataPackageId/overview/generate/:version', { + dataPackageId: '@dataPackageId', + version: '@version' + }, { + 'startGeneration': { + method: 'POST', + params: {languages: '@languages'} + } + }); + }); diff --git a/src/main/webapp/scripts/datapackagemanagement/views/create-overview-dialog.controller.js b/src/main/webapp/scripts/datapackagemanagement/views/create-overview-dialog.controller.js new file mode 100644 index 0000000000..753038b8f3 --- /dev/null +++ b/src/main/webapp/scripts/datapackagemanagement/views/create-overview-dialog.controller.js @@ -0,0 +1,35 @@ +'use strict'; + +angular.module('metadatamanagementApp') + .controller('CreateOverviewDialogController', function($scope, $mdDialog, + $rootScope) { + $scope.bowser = $rootScope.bowser; + var ctrl = this; + ctrl.german = true; + + ctrl.cancel = function() { + $mdDialog.cancel(); + }; + + ctrl.validateLanguages = function() { + if (!ctrl.german && !ctrl.english) { + $scope.reportForm.german.$setValidity('not-empty', false); + } else { + $scope.reportForm.german.$setValidity('not-empty', true); + } + }; + + ctrl.ok = function() { + var languages = []; + if (ctrl.german) { + languages.push('de'); + } + if (ctrl.english) { + languages.push('en'); + } + $mdDialog.hide({ + version: ctrl.version, + languages: languages + }); + }; + }); diff --git a/src/main/webapp/scripts/datapackagemanagement/views/create-overview-dialog.html.tmpl b/src/main/webapp/scripts/datapackagemanagement/views/create-overview-dialog.html.tmpl new file mode 100644 index 0000000000..9bb8b66211 --- /dev/null +++ b/src/main/webapp/scripts/datapackagemanagement/views/create-overview-dialog.html.tmpl @@ -0,0 +1,71 @@ + + +
+
+

+ {{'data-package-management.create-overview.title' | translate}} +

+
+ + clear + + {{'data-package-management.create-overview.tooltip.cancel' | translate }} + + +
+
+ +
+ + + + +
+ {{'data-package-management.create-overview.hints.version' | translate}} +
+
+
{{'data-package-management.create-overview.error.version.not-empty' | translate}}
+
{{'data-package-management.create-overview.error.version.size' | translate}}
+
{{'data-package-management.create-overview.error.version.pattern' | translate }}
+
+
+ + + {{'data-package-management.create-overview.languages.in-german' | translate }} + + + {{'data-package-management.create-overview.languages.in-english' | translate }} + +
{{'data-package-management.create-overview.hints.languages' | translate}} +
+
+
{{'data-package-management.create-overview.error.languages.not-empty' | translate}} +
+
+
+
+ + + {{'global.entity.action.cancel' | translate}} + + {{'data-package-management.create-overview.tooltip.cancel' | translate }} + + + + {{'global.entity.action.ok' | translate}} + + {{'data-package-management.create-overview.tooltip.ok' | translate }} + + + +
+
diff --git a/src/main/webapp/scripts/datapackagemanagement/views/data-package-detail.controller.js b/src/main/webapp/scripts/datapackagemanagement/views/data-package-detail.controller.js index ef15460726..fb22972b2e 100644 --- a/src/main/webapp/scripts/datapackagemanagement/views/data-package-detail.controller.js +++ b/src/main/webapp/scripts/datapackagemanagement/views/data-package-detail.controller.js @@ -6,14 +6,14 @@ angular.module('metadatamanagementApp') MessageBus, PageMetadataService, LanguageService, - $state, $location, + $state, $location, $mdDialog, BreadcrumbService, Principal, SimpleMessageToastService, SearchResultNavigatorService, $stateParams, DataAcquisitionProjectAttachmentsResource, $rootScope, DataAcquisitionProjectResource, ProjectUpdateAccessService, $scope, - $timeout, $document, + $timeout, $document, DataPackageOverviewResource, OutdatedVersionNotifier, DataPackageSearchService, $log, blockUI, $mdSidenav, ContainsOnlyQualitativeDataChecker) { blockUI.start(); @@ -157,4 +157,25 @@ angular.module('metadatamanagementApp') ctrl.toggleSidenav = function() { $mdSidenav('SideNavBar').toggle(); }; + + ctrl.generateDataPackageOverview = function(event) { + $mdDialog.show({ + controller: 'CreateOverviewDialogController', + controllerAs: 'ctrl', + templateUrl: 'scripts/datapackagemanagement/' + + 'views/create-overview-dialog.html.tmpl', + clickOutsideToClose: false, + fullscreen: true, + targetEvent: event + }).then(function(result) { + DataPackageOverviewResource.startGeneration({ + dataPackageId: ctrl.dataPackage.id, + version: result.version, + languages: result.languages}).$promise.then(function() { + SimpleMessageToastService.openSimpleMessageToast( + 'data-package-management.detail.' + + 'overview-generation-started-toast'); + }); + }); + }; }); diff --git a/src/main/webapp/scripts/datapackagemanagement/views/data-package-detail.html.tmpl b/src/main/webapp/scripts/datapackagemanagement/views/data-package-detail.html.tmpl index 04d6a4d3ae..69abb872a3 100644 --- a/src/main/webapp/scripts/datapackagemanagement/views/data-package-detail.html.tmpl +++ b/src/main/webapp/scripts/datapackagemanagement/views/data-package-detail.html.tmpl @@ -62,6 +62,13 @@
+ + + {{'data-package-management.detail.generate-datapackage-overview-tooltip' | translate}} + + picture_as_pdf + + ng-click="ctrl.generateDataSetReport($event)" ng-if="!ctrl.projectIsCurrentlyReleased"> {{'data-set-management.detail.generate-dataset-report-tooltip' | translate}} diff --git a/src/main/webapp/scripts/surveymanagement/configuration/translations-de.js b/src/main/webapp/scripts/surveymanagement/configuration/translations-de.js index 64f618bfcf..58b5f9e76d 100644 --- a/src/main/webapp/scripts/surveymanagement/configuration/translations-de.js +++ b/src/main/webapp/scripts/surveymanagement/configuration/translations-de.js @@ -104,7 +104,13 @@ angular.module('metadatamanagementApp').config( 'concepts': { 'one': 'Klicken, um das Konzept, welches in dieser Erhebung gemessen wurde, anzuzeigen', 'many': 'Klicken, um alle Konzepte, die in dieser Erhebung gemessen wurden, anzuzeigen' - } + }, + 'show-serial-number-help': 'Klicken, um Erläuterungen zur Ordnungsnummer zu anzuzeigen.' + }, + 'serial-number-info': { + 'title': 'Ordnungsnummer', + 'content': '

Die Ordnungsnummer der Erhebung repräsentiert die Nummer der Erhebung, wie sie im Erhebungsdesign angelegt ist (z.B. Nummer der Panelwelle).

', + 'close-tooltip': 'Klicken, um diese Erläuterungen zu schließen.' } }, 'error': { diff --git a/src/main/webapp/scripts/surveymanagement/configuration/translations-en.js b/src/main/webapp/scripts/surveymanagement/configuration/translations-en.js index 6393f3a9c8..faa46b5b19 100644 --- a/src/main/webapp/scripts/surveymanagement/configuration/translations-en.js +++ b/src/main/webapp/scripts/surveymanagement/configuration/translations-en.js @@ -104,7 +104,13 @@ angular.module('metadatamanagementApp').config( 'concepts': { 'one': 'Click to show the concept which has been measured in this survey', 'many': 'Click to show all concepts which have been measured in this survey' - } + }, + 'show-serial-number-help': 'Click to show an explanation of the ordinal number.' + }, + 'serial-number-info': { + 'title': 'Serial Number', + 'content': '

The serial number of the survey represents the number of the survey as it is implemented in the survey design (e.g. number of the panel wave).

', + 'close-tooltip': 'Click to close this explanation.' } }, 'error': { diff --git a/src/main/webapp/scripts/surveymanagement/templates/common-details.html.tmpl b/src/main/webapp/scripts/surveymanagement/templates/common-details.html.tmpl index 1a928a1cef..d57148b2e4 100644 --- a/src/main/webapp/scripts/surveymanagement/templates/common-details.html.tmpl +++ b/src/main/webapp/scripts/surveymanagement/templates/common-details.html.tmpl @@ -14,8 +14,16 @@ -
{{'survey-management.detail.label.serial-number' | translate }}:
- {{ $ctrl.options.survey.serialNumber }} +
{{'survey-management.detail.label.serial-number' | translate }}: +
+ {{ $ctrl.options.survey.serialNumber }} + + info + + {{'survey-management.detail.tooltips.show-serial-number-help' | translate}} + + +
{{'survey-management.detail.label.population' | translate }}:
diff --git a/src/main/webapp/scripts/surveymanagement/views/serial-number-info.controller.js b/src/main/webapp/scripts/surveymanagement/views/serial-number-info.controller.js new file mode 100644 index 0000000000..090cb2b69b --- /dev/null +++ b/src/main/webapp/scripts/surveymanagement/views/serial-number-info.controller.js @@ -0,0 +1,12 @@ +/* global bowser */ +'use strict'; + +angular.module('metadatamanagementApp') + .controller('SerialNumberInfoController', + function($scope, $mdDialog) { + $scope.bowser = bowser; + + $scope.closeDialog = function() { + $mdDialog.cancel(); + }; + }); diff --git a/src/main/webapp/scripts/surveymanagement/views/serial-number-info.html.tmpl b/src/main/webapp/scripts/surveymanagement/views/serial-number-info.html.tmpl new file mode 100644 index 0000000000..93f9dc8721 --- /dev/null +++ b/src/main/webapp/scripts/surveymanagement/views/serial-number-info.html.tmpl @@ -0,0 +1,27 @@ + + +
+

+ {{'survey-management.detail.serial-number-info.title' | translate}} +

+ + clear + + {{'survey-management.detail.serial-number-info.close-tooltip' | translate }} + + +
+
+ + + + + + + {{'global.entity.action.ok' | translate}} + + {{'survey-management.detail.serial-number-info.close-tooltip' | translate }} + + + +
diff --git a/src/main/webapp/scripts/surveymanagement/views/survey-detail.controller.js b/src/main/webapp/scripts/surveymanagement/views/survey-detail.controller.js index 6771c4497b..efe8baec89 100644 --- a/src/main/webapp/scripts/surveymanagement/views/survey-detail.controller.js +++ b/src/main/webapp/scripts/surveymanagement/views/survey-detail.controller.js @@ -8,7 +8,7 @@ angular.module('metadatamanagementApp') SurveySearchService, SurveyAttachmentResource, Principal, SimpleMessageToastService, SearchResultNavigatorService, SurveyResponseRateImageUploadService, OutdatedVersionNotifier, - DataAcquisitionProjectResource, + DataAcquisitionProjectResource, $mdDialog, ProjectUpdateAccessService, CountryCodesResource, $stateParams, blockUI, $mdSidenav) { blockUI.start(); @@ -135,6 +135,18 @@ angular.module('metadatamanagementApp') } }; + ctrl.showSerialNumberInfo = function($event) { + $mdDialog.show({ + controller: 'SerialNumberInfoController', + templateUrl: 'scripts/surveymanagement/views/' + + 'serial-number-info.html.tmpl', + clickOutsideToClose: true, + escapeToClose: true, + fullscreen: true, + targetEvent: $event + }); + }; + ctrl.toggleSidenav = function() { $mdSidenav('SideNavBar').toggle(); }; diff --git a/src/test/robotframework/data_provider/datapackagemanagement/create_data_package_overview.robot b/src/test/robotframework/data_provider/datapackagemanagement/create_data_package_overview.robot new file mode 100644 index 0000000000..9507e943c7 --- /dev/null +++ b/src/test/robotframework/data_provider/datapackagemanagement/create_data_package_overview.robot @@ -0,0 +1,34 @@ +*** Settings *** +Documentation Generate a data package overview. +Library OperatingSystem +Resource ../../resources/home_page_resource.robot +Resource ../../resources/search_resource.robot + +*** Test Cases *** +Create Data Package Overview + Select project by name gra2005 + Click on data package tab + Click on first search result + Click Overview Button + Select English + Write Overview Version + Page Should Not Contain Element xpath=//md-toast[contains(@class,'md-accent')] + Get back to home page and deselect project + +*** Keywords *** +Get back to home page and deselect project + Get back to german home page + Click Element Through Tooltips xpath=//md-sidenav//project-navbar-module//button[@aria-label='Clear Input'] + +Write Overview Version + Input Text name=version 1.0.0 + Click on OK Button + +Click Overview Button + Click Element Through Tooltips xpath=//button//md-icon[contains(.,'pdf')] + +Click on OK Button + Click Element Through Tooltips xpath=//md-dialog-actions//button//span[contains(.,'OK')] + +Select English + Click Element Through Tooltips xpath=//md-checkbox[@name="english"]