本文整理汇总了Java中org.axway.grapes.utils.client.GrapesClient类的典型用法代码示例。如果您正苦于以下问题:Java GrapesClient类的具体用法?Java GrapesClient怎么用?Java GrapesClient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GrapesClient类属于org.axway.grapes.utils.client包,在下文中一共展示了GrapesClient类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: NotificationHandler
import org.axway.grapes.utils.client.GrapesClient; //导入依赖的package包/类
public NotificationHandler(final GrapesConfig config) {
client = new GrapesClient(config.getHost(), String.valueOf(config.getPort()));
if (config.getPublisherCredentials() != null) {
user = config.getPublisherCredentials().getUsername();
password = config.getPublisherCredentials().getPassword();
}
}
示例2: doTestConnection
import org.axway.grapes.utils.client.GrapesClient; //导入依赖的package包/类
/**
* Performs on-the-fly validation of the form field 'credentials'.
*
* @param host String
* @param port String
* @param timeout String
* @return
*/
public FormValidation doTestConnection(@QueryParameter final String host, @QueryParameter final String port, @QueryParameter final String timeout) {
final GrapesClient client = new GrapesClient(host, port);
if (client.isServerAvailable()) {
return FormValidation.ok("Success.");
}
else {
return FormValidation.warning("Server not reachable!");
}
}
示例3: GrapesBuildAction
import org.axway.grapes.utils.client.GrapesClient; //导入依赖的package包/类
/**
* Initiate the report
*
* @param module Module
* @param grapesClient GrapesClient
*/
public GrapesBuildAction(final Module module, final GrapesClient grapesClient) {
if(grapesClient == null ||
module == null ){
return;
}
title = "Dependency report of " + module.getName() + " in version " + module.getVersion();
// Init the report with Grapes server information
try{
final Organization organization = grapesClient.getModuleOrganization(module.getName(), module.getVersion());
final List<String> corporateFilters = organization.getCorporateGroupIdPrefixes();
dependencies = new HashMap<Dependency, String>();
final List<Dependency> moduleDependencies = ModuleUtils.getCorporateDependencies(module, corporateFilters);
for(Dependency dependency: moduleDependencies){
final String lastVersion = getLastVersion(grapesClient, dependency);
this.dependencies.put(dependency, lastVersion);
}
thirdParty = ModuleUtils.getThirdPartyLibraries(module, corporateFilters);
ancestors = grapesClient.getModuleAncestors(module.getName(), module.getVersion());
initOk = true;
} catch (Exception e){
GrapesPlugin.getLogger().log(Level.WARNING, "Failed to generate build dependency report for " + module.getName(), e);
}
}
示例4: getLastVersion
import org.axway.grapes.utils.client.GrapesClient; //导入依赖的package包/类
/**
* Returns the last version of a dependency
*
*
* @param grapesClient
* @param dependency Dependency
* @return String
*/
public String getLastVersion(final GrapesClient grapesClient, final Dependency dependency){
final Logger logger = LogManager.getLogManager().getLogger("hudson.WebAppMain");
try{
final Artifact target = dependency.getTarget();
return grapesClient.getArtifactLastVersion(target.getGavc());
} catch (GrapesCommunicationException e) {
logger.info("Failed to get last version of : " + dependency.getTarget().getGavc());
}
return "";
}
示例5: execute
import org.axway.grapes.utils.client.GrapesClient; //导入依赖的package包/类
public void execute() throws MojoExecutionException {
if (isExecuteSkipped()) {
return;
}
// Execute only one time
if(project.equals(reactorProjects.get(0))){
try {
final File workingFolder = GrapesMavenPlugin.getGrapesPluginWorkingFolder(reactorProjects.get(0));
final Module rootModule = GrapesMavenPlugin.getModule(workingFolder, GrapesMavenPlugin.MODULE_JSON_FILE_NAME);
getLog().info("Sending " + rootModule.getName() + "...");
getLog().info("Connection to Grapes");
getLog().info("Host: " + host);
getLog().info("Port: " + port);
getLog().info("User: " + user);
final GrapesClient client = new GrapesClient(host, port);
if(!client.isServerAvailable()){
throw new MojoExecutionException("Grapes is unreachable");
}
client.postModule(rootModule, user, password);
getLog().info("Information successfully sent");
} catch (Exception e) {
if(failOnError){
throw new MojoExecutionException("An error occurred during Grapes server Notification." , e);
}
else{
getLog().debug("An error occurred during Grapes server Notification.", e);
getLog().info("Failed to send information to Grapes");
}
}
}
}