@Test public void convert_not_approved() { Result sourceDataset = documentEntity(EXT_IDENTIFIERS); when(fieldApprover.approve(any())).thenReturn(false); DataSetReference metadata = converter.convert(sourceDataset); assertNotNull(metadata); assertEquals(ID, metadata.getId()); assertEquals("unspecified", metadata.getReferenceType()); assertEquals("", metadata.getIdForGivenType()); assertEquals(1, metadata.getCreatorNames().size()); assertEquals(FULL_NAME, metadata.getCreatorNames().get(0)); assertEquals(0, metadata.getTitles().size()); assertNull(metadata.getDescription()); assertNull(metadata.getPublisher()); assertNull(metadata.getPublicationYear()); assertEquals(0, metadata.getFormats().size()); assertEquals("resource_type", metadata.getResourceTypeValue()); assertNull(metadata.getAlternateIdentifiers()); }
@Override public DataSetReference convert(Result dataset) { Objects.requireNonNull(dataset); DataSetReference.Builder builder = DataSetReference.newBuilder(); builder.setId(dataset.getId()); createBasicMetadata(dataset, builder); handleAdditionalIds(dataset, builder); handlePersons(dataset, builder); if (builder.getReferenceType() == null) { builder.setReferenceType(REFERENCE_TYPE_UNSPECIFIED); } if (builder.getIdForGivenType() == null) { builder.setIdForGivenType(""); } return builder.build(); }
DatasetMetadataConverter implements OafEntityToAvroConverter<Result, DataSetReference> { @Override public DataSetReference convert(Result dataset) { Objects.requireNonNull(dataset); DataSetReference.Builder builder = DataSetReference.newBuilder(); builder.setId(dataset.getId()); createBasicMetadata(dataset, builder); handleAdditionalIds(dataset, builder); handlePersons(dataset, builder); if (builder.getReferenceType() == null) { builder.setReferenceType(REFERENCE_TYPE_UNSPECIFIED); } if (builder.getIdForGivenType() == null) { builder.setIdForGivenType(""); } return builder.build(); } }
DatasetMetadataConverter implements OafEntityToAvroConverter<Result, DataSetReference> { @Override public DataSetReference convert(Result dataset) { Objects.requireNonNull(dataset); DataSetReference.Builder builder = DataSetReference.newBuilder(); builder.setId(dataset.getId()); createBasicMetadata(dataset, builder); handleAdditionalIds(dataset, builder); handlePersons(dataset, builder); if (builder.getReferenceType() == null) { builder.setReferenceType(REFERENCE_TYPE_UNSPECIFIED); } if (builder.getIdForGivenType() == null) { builder.setIdForGivenType(""); } return builder.build(); } DatasetMetadataConverter(FieldApprover fieldApprover); }
DatasetMetadataConverter implements OafEntityToAvroConverter<Result, DataSetReference> { @Override public DataSetReference convert(Result dataset) { Objects.requireNonNull(dataset); DataSetReference.Builder builder = DataSetReference.newBuilder(); builder.setId(dataset.getId()); createBasicMetadata(dataset, builder); handleAdditionalIds(dataset, builder); handlePersons(dataset, builder); if (builder.getReferenceType() == null) { builder.setReferenceType(REFERENCE_TYPE_UNSPECIFIED); } if (builder.getIdForGivenType() == null) { builder.setIdForGivenType(""); } return builder.build(); } DatasetMetadataConverter(FieldApprover fieldApprover); @Override DataSetReference convert(Result dataset); }
DatasetMetadataConverter implements OafEntityToAvroConverter<Result, DataSetReference> { @Override public DataSetReference convert(Result dataset) { Objects.requireNonNull(dataset); DataSetReference.Builder builder = DataSetReference.newBuilder(); builder.setId(dataset.getId()); createBasicMetadata(dataset, builder); handleAdditionalIds(dataset, builder); handlePersons(dataset, builder); if (builder.getReferenceType() == null) { builder.setReferenceType(REFERENCE_TYPE_UNSPECIFIED); } if (builder.getIdForGivenType() == null) { builder.setIdForGivenType(""); } return builder.build(); } DatasetMetadataConverter(FieldApprover fieldApprover); @Override DataSetReference convert(Result dataset);  }