@Test public void sendBuildInfoTest() throws IOException { final String BUILD_NAME = "ArtifactoryBuildInfoClientTest"; final String BUILD_NUMBER = "13"; final Date STARTED = new Date(); final List<Vcs> VCS = Lists.newArrayList(new Vcs("foo", "1"), new Vcs("bar", "2"), new Vcs("baz", "3")); final List<MatrixParameter> RUN_PARAMETERS = Lists.newArrayList(new MatrixParameter("a", "b"), new MatrixParameter("c", "d")); final Module module = new Module(); module.setId("foo"); SimpleDateFormat simpleDateFormat = new SimpleDateFormat(Build.STARTED_FORMAT); final List<PromotionStatus> STATUSES = Lists.newArrayList(new PromotionStatus("a", "b", "c", simpleDateFormat.format(STARTED), "e", "f")); BuildInfoBuilder buildInfoBuilder = new BuildInfoBuilder(BUILD_NAME) .number(BUILD_NUMBER) .buildAgent(new BuildAgent("agent11", "11")) .agent(new Agent("agent22", "22")) .startedDate(STARTED) .durationMillis(100) .principal("foo") .artifactoryPrincipal(getUsername()) .artifactoryPluginVersion("2.3.1") .url(getUrl()) .parentName("baz") .parentNumber("10") .vcs(VCS) .licenseControl(new LicenseControl(false)) .buildRetention(new BuildRetention(true)) .buildRunParameters(RUN_PARAMETERS) .modules(Lists.newArrayList(module)) .statuses(STATUSES) .issues(new Issues()); Build buildInfoToSend = buildInfoBuilder.build(); buildInfoClient.sendBuildInfo(buildInfoToSend); Build receivedBuildInfo = buildInfoClient.getBuildInfo(BUILD_NAME, BUILD_NUMBER); Assert.assertEquals(buildInfoClient.toJsonString(buildInfoToSend), buildInfoClient.toJsonString(receivedBuildInfo)); }
public void sendBuildInfo(String buildInfoJson) throws IOException { String url = String.format("%s%s", artifactoryUrl, BUILD_REST_URL); HttpPut httpPut = new HttpPut(url); try { log.info("Deploying build descriptor to: " + httpPut.getURI().toString()); sendHttpEntityRequest(httpPut, buildInfoJson, APPLICATION_VND_ORG_JFROG_ARTIFACTORY_JSON); } catch (IOException e) { throw new IOException("Failed to send build descriptor. " + e.getMessage(), e); } }
ArtifactoryBuildInfoClient extends ArtifactoryBaseClient implements AutoCloseable { public void sendBuildInfo(String buildInfoJson) throws IOException { String url = String.format("%s%s", artifactoryUrl, BUILD_REST_URL); HttpPut httpPut = new HttpPut(url); try { log.info("Deploying build descriptor to: " + httpPut.getURI().toString()); sendHttpEntityRequest(httpPut, buildInfoJson, APPLICATION_VND_ORG_JFROG_ARTIFACTORY_JSON); } catch (IOException e) { throw new IOException("Failed to send build descriptor. " + e.getMessage(), e); } } }
ArtifactoryBuildInfoClient extends ArtifactoryBaseClient implements AutoCloseable { public void sendBuildInfo(String buildInfoJson) throws IOException { String url = String.format("%s%s", artifactoryUrl, BUILD_REST_URL); HttpPut httpPut = new HttpPut(url); try { log.info("Deploying build descriptor to: " + httpPut.getURI().toString()); sendHttpEntityRequest(httpPut, buildInfoJson, APPLICATION_VND_ORG_JFROG_ARTIFACTORY_JSON); } catch (IOException e) { throw new IOException("Failed to send build descriptor. " + e.getMessage(), e); } } ArtifactoryBuildInfoClient(String artifactoryUrl, Log log);  ArtifactoryBuildInfoClient(String artifactoryUrl, String username, String password, String accessToken, Log log);  ArtifactoryBuildInfoClient(String artifactoryUrl, String username, String password, Log log); }
ArtifactoryBuildInfoClient extends ArtifactoryBaseClient implements AutoCloseable { public void sendBuildInfo(String buildInfoJson) throws IOException { String url = String.format("%s%s", artifactoryUrl, BUILD_REST_URL); HttpPut httpPut = new HttpPut(url); try { log.info("Deploying build descriptor to: " + httpPut.getURI().toString()); sendHttpEntityRequest(httpPut, buildInfoJson, APPLICATION_VND_ORG_JFROG_ARTIFACTORY_JSON); } catch (IOException e) { throw new IOException("Failed to send build descriptor. " + e.getMessage(), e); } } ArtifactoryBuildInfoClient(String artifactoryUrl, Log log);  ArtifactoryBuildInfoClient(String artifactoryUrl, String username, String password, String accessToken, Log log);  ArtifactoryBuildInfoClient(String artifactoryUrl, String username, String password, Log log); List<String> getLocalRepositoriesKeys(); List<String> getLocalAndCacheRepositoriesKeys(); List<String> getRemoteRepositoriesKeys(); List<String> getVirtualRepositoryKeys(); void sendBuildInfo(String buildInfoJson); Build getBuildInfo(String buildName, String buildNumber); void sendBuildRetetion(BuildRetention buildRetention, String buildName, boolean async); void sendBuildInfo(Build buildInfo); void sendModuleInfo(Build build); ItemLastModified getItemLastModified(String path); ArtifactoryUploadResponse deployArtifact(DeployDetails details); ArtifactoryUploadResponse deployArtifact(DeployDetails details, String logPrefix); ArtifactoryVersion verifyCompatibleArtifactoryVersion(); BintrayResponse pushToBintray(String buildName, String buildNumber, String signMethod, String passphrase,
                                         BintrayUploadInfoOverride bintrayUploadInfo); HttpResponse stageBuild(String buildName, String buildNumber, Promotion promotion); HttpResponse distributeBuild(String buildName, String buildNumber, Distribution promotion); Map<String, List<Map>> getUserPluginInfo(); HttpResponse executeUserPlugin(String executionName, Map<String, String> requestParams); Map getStagingStrategy(String strategyName, String buildName, Map<String, String> requestParams); HttpResponse executePromotionUserPlugin(String promotionName, String buildName, String buildNumber,
                                                   Map<String, String> requestParams); HttpResponse executeUpdateFileProperty(String itemPath, String properties); String buildInfoToJsonString(Build buildInfo); void uploadChecksums(DeployDetails details, String uploadUrl); void reportUsage(UsageReporter usageReporter); }
ArtifactoryBuildInfoClient extends ArtifactoryBaseClient implements AutoCloseable { public void sendBuildInfo(String buildInfoJson) throws IOException { String url = String.format("%s%s", artifactoryUrl, BUILD_REST_URL); HttpPut httpPut = new HttpPut(url); try { log.info("Deploying build descriptor to: " + httpPut.getURI().toString()); sendHttpEntityRequest(httpPut, buildInfoJson, APPLICATION_VND_ORG_JFROG_ARTIFACTORY_JSON); } catch (IOException e) { throw new IOException("Failed to send build descriptor. " + e.getMessage(), e); } } ArtifactoryBuildInfoClient(String artifactoryUrl, Log log);  ArtifactoryBuildInfoClient(String artifactoryUrl, String username, String password, String accessToken, Log log);  ArtifactoryBuildInfoClient(String artifactoryUrl, String username, String password, Log log); List<String> getLocalRepositoriesKeys(); List<String> getLocalAndCacheRepositoriesKeys(); List<String> getRemoteRepositoriesKeys(); List<String> getVirtualRepositoryKeys(); void sendBuildInfo(String buildInfoJson); Build getBuildInfo(String buildName, String buildNumber); void sendBuildRetetion(BuildRetention buildRetention, String buildName, boolean async); void sendBuildInfo(Build buildInfo); void sendModuleInfo(Build build); ItemLastModified getItemLastModified(String path); ArtifactoryUploadResponse deployArtifact(DeployDetails details); ArtifactoryUploadResponse deployArtifact(DeployDetails details, String logPrefix); ArtifactoryVersion verifyCompatibleArtifactoryVersion(); BintrayResponse pushToBintray(String buildName, String buildNumber, String signMethod, String passphrase,
                                         BintrayUploadInfoOverride bintrayUploadInfo); HttpResponse stageBuild(String buildName, String buildNumber, Promotion promotion); HttpResponse distributeBuild(String buildName, String buildNumber, Distribution promotion); Map<String, List<Map>> getUserPluginInfo(); HttpResponse executeUserPlugin(String executionName, Map<String, String> requestParams); Map getStagingStrategy(String strategyName, String buildName, Map<String, String> requestParams); HttpResponse executePromotionUserPlugin(String promotionName, String buildName, String buildNumber,
                                                   Map<String, String> requestParams); HttpResponse executeUpdateFileProperty(String itemPath, String properties); String buildInfoToJsonString(Build buildInfo); void uploadChecksums(DeployDetails details, String uploadUrl); void reportUsage(UsageReporter usageReporter); static final String BUILD_BROWSE_URL; static final String APPLICATION_VND_ORG_JFROG_ARTIFACTORY_JSON; static final String APPLICATION_JSON; static final String ITEM_LAST_MODIFIED; }