Search in sources :

Example 1 with MetadataAddRequest

use of org.apache.archiva.rest.api.model.MetadataAddRequest in project archiva by apache.

the class BrowseServiceTest method metadatainbatchmode.

@Test
public void metadatainbatchmode() throws Exception {
    scanRepo(TEST_REPO_ID);
    waitForScanToComplete(TEST_REPO_ID);
    BrowseService browseService = getBrowseService(authorizationHeader, false);
    Map<String, String> inputMetadata = new HashMap<>(3);
    inputMetadata.put("buildNumber", "1");
    inputMetadata.put("author", "alecharp");
    inputMetadata.put("jenkins_version", "1.486");
    MetadataAddRequest metadataAddRequest = new MetadataAddRequest();
    metadataAddRequest.setGroupId("commons-cli");
    metadataAddRequest.setArtifactId("commons-cli");
    metadataAddRequest.setVersion("1.0");
    metadataAddRequest.setMetadatas(inputMetadata);
    browseService.importMetadata(metadataAddRequest, TEST_REPO_ID);
    Map<String, String> metadatas = toMap(browseService.getMetadatas("commons-cli", "commons-cli", "1.0", TEST_REPO_ID));
    assertThat(metadatas).isNotNull().isNotEmpty().contains(MapEntry.entry("buildNumber", "1")).contains(MapEntry.entry("author", "alecharp")).contains(MapEntry.entry("jenkins_version", "1.486"));
}
Also used : MetadataAddRequest(org.apache.archiva.rest.api.model.MetadataAddRequest) HashMap(java.util.HashMap) BrowseService(org.apache.archiva.rest.api.services.BrowseService) Test(org.junit.Test)

Aggregations

HashMap (java.util.HashMap)1 MetadataAddRequest (org.apache.archiva.rest.api.model.MetadataAddRequest)1 BrowseService (org.apache.archiva.rest.api.services.BrowseService)1 Test (org.junit.Test)1