本文整理汇总了Java中pl.touk.sputnik.configuration.CliOption类的典型用法代码示例。如果您正苦于以下问题:Java CliOption类的具体用法?Java CliOption怎么用?Java CliOption使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CliOption类属于pl.touk.sputnik.configuration包,在下文中一共展示了CliOption类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildGerritPatchset
import pl.touk.sputnik.configuration.CliOption; //导入依赖的package包/类
@NotNull
private GerritPatchset buildGerritPatchset(Configuration configuration) {
String changeId = configuration.getProperty(CliOption.CHANGE_ID);
String revisionId = configuration.getProperty(CliOption.REVISION_ID);
notBlank(changeId, "You must provide non blank Gerrit change Id");
notBlank(revisionId, "You must provide non blank Gerrit revision Id");
return new GerritPatchset(changeId, revisionId);
}
示例2: buildStashPatchset
import pl.touk.sputnik.configuration.CliOption; //导入依赖的package包/类
@NotNull
public StashPatchset buildStashPatchset(Configuration configuration) {
String pullRequestId = configuration.getProperty(CliOption.PULL_REQUEST_ID);
String repositorySlug = configuration.getProperty(GeneralOption.REPOSITORY);
String projectKey = configuration.getProperty(GeneralOption.PROJECT);
notBlank(pullRequestId, "You must provide non blank Stash pull request id");
notBlank(repositorySlug, "You must provide non blank Stash repository slug");
notBlank(projectKey, "You must provide non blank Stash project key");
return new StashPatchset(pullRequestId, repositorySlug, projectKey);
}
示例3: build
import pl.touk.sputnik.configuration.CliOption; //导入依赖的package包/类
@NotNull
public static Patchset build(Configuration configuration) {
String pullRequestId = configuration.getProperty(CliOption.PULL_REQUEST_ID);
String project = configuration.getProperty(GeneralOption.PROJECT);
String repository = configuration.getProperty(GeneralOption.REPOSITORY);
Provider provider = Provider.from(configuration.getProperty(CliOption.PROVIDER));
notBlank(pullRequestId, "You must provide non blank pull request id");
isTrue(NumberUtils.isNumber(pullRequestId), "Integer value as pull request id required");
notBlank(project, "You must provide non blank project key");
notBlank(repository, "You must provide non blank repository slug");
notNull(provider, "You must provide non blank SCM provider");
return new Patchset(Integer.parseInt(pullRequestId), String.format("%s/%s", project, repository), provider);
}
示例4: build
import pl.touk.sputnik.configuration.CliOption; //导入依赖的package包/类
@NotNull
public SaasFacade build(Configuration configuration) {
ConnectorDetails connectorDetails = new ConnectorDetails(configuration);
String apiKey = configuration.getProperty(CliOption.API_KEY);
String buildId = configuration.getProperty(CliOption.BUILD_ID);
HttpHost httpHost = httpHelper.buildHttpHost(connectorDetails);
HttpClientContext httpClientContext = httpHelper.buildClientContext(httpHost, new BasicScheme());
CloseableHttpClient closeableHttpClient = httpHelper.buildClient(httpHost, connectorDetails);
return new SaasFacade(new SaasConnector(
new HttpConnector(closeableHttpClient, httpClientContext, connectorDetails.getPath()),
PatchsetBuilder.build(configuration), apiKey, buildId), new Gson());
}
示例5: shouldAddRegexFilterToBeforeVisitorsWhenConfigured
import pl.touk.sputnik.configuration.CliOption; //导入依赖的package包/类
@Test
public void shouldAddRegexFilterToBeforeVisitorsWhenConfigured() {
Configuration config = new ConfigurationSetup().setUp(ImmutableMap.of(
CliOption.FILE_REGEX.getKey(), "^myModule/.+"
));
assertThat(new VisitorBuilder().buildBeforeReviewVisitors(config))
.hasSize(1)
.extracting("class")
.containsExactly(RegexFilterFilesVisitor.class);
}
示例6: shouldExecuteGerritReview
import pl.touk.sputnik.configuration.CliOption; //导入依赖的package包/类
@Test
public void shouldExecuteGerritReview() throws Exception {
// given
String[] args = toArgs("-conf %s -changeId %s -revisionId %s",
SAMPLE_CONFIG, SAMPLE_CHANGE_ID, SAMPLE_REVISION_ID);
// when
CommandLine commandLine = fixture.parse(args);
// then
cliAssert(commandLine).hasOption(CliOption.CONF.getCommandLineParam()).withValue(SAMPLE_CONFIG);
cliAssert(commandLine).hasOption(CliOption.CHANGE_ID.getCommandLineParam()).withValue(SAMPLE_CHANGE_ID);
cliAssert(commandLine).hasOption(CliOption.REVISION_ID.getCommandLineParam()).withValue(SAMPLE_REVISION_ID);
}
示例7: shouldExecuteStashReview
import pl.touk.sputnik.configuration.CliOption; //导入依赖的package包/类
@Test
public void shouldExecuteStashReview() throws Exception {
// given
String[] args = toArgs("-conf %s -pullRequestId %s", SAMPLE_CONFIG, SAMPLE_PULL_REQUEST_ID);
// when
CommandLine commandLine = fixture.parse(args);
// then
cliAssert(commandLine).hasOption(CliOption.PULL_REQUEST_ID.getCommandLineParam()).withValue(SAMPLE_PULL_REQUEST_ID);
}
示例8: setConnectorProperties
import pl.touk.sputnik.configuration.CliOption; //导入依赖的package包/类
@Override
protected void setConnectorProperties() {
setConnectorProperty(CliOption.PULL_REQUEST_ID, pullRequestId);
setConnectorProperty(GeneralOption.PROJECT_KEY, connectorProjectKey);
setConnectorProperty(GeneralOption.REPOSITORY_SLUG, connectorRepositorySlug);
}
示例9: execute
import pl.touk.sputnik.configuration.CliOption; //导入依赖的package包/类
public void execute() throws MojoExecutionException, MojoFailureException {
try {
Properties theSputnikProperties = new Properties();
theSputnikProperties.load(getClass().getResourceAsStream("/default-sputnik.properties"));
try (InputStream theStream = new FileInputStream(sputnikConfiguration)) {
theSputnikProperties.load(theStream);
}
String theChangeID = gerritChangeId;
if (StringUtils.isEmpty(theChangeID)) {
theChangeID = System.getProperty("GERRIT_CHANGE_ID");
}
if (StringUtils.isEmpty(theChangeID)) {
theChangeID = System.getenv("GERRIT_CHANGE_ID");
}
if (StringUtils.isEmpty(theChangeID)) {
getLog().info("Disabling Plugin as no GERRIT_CHANGE_ID was set in the environment, as a system property or the plugin configuration (gerritChangeId).");
return;
}
String theRevision = gerritRevision;
if (StringUtils.isEmpty(theRevision)) {
theRevision = System.getProperty("GERRIT_PATCHSET_REVISION");
}
if (StringUtils.isEmpty(theRevision)) {
theRevision = System.getenv("GERRIT_PATCHSET_REVISION");
}
if (StringUtils.isEmpty(theRevision)) {
getLog().info("Disabling Plugin as no GERRIT_PATCHSET_REVISION was set in the environment, as a system property or the plugin configuration (gerritRevision).");
return;
}
theSputnikProperties.setProperty(CliOption.CHANGE_ID.getKey(), theChangeID);
theSputnikProperties.setProperty(CliOption.REVISION_ID.getKey(), theRevision);
MavenEnvironment.initialize(mavenSession, pluginManager, getLog(),
dependencyTreeBuilder, localRepository,
securityDispatcher, projectBuilder,
lifecycleExecutor, artifactFactory,
artifactMetadataSource, artifactCollector, runtimeInformation, mojoExecution);
Configuration theConfiguration = ConfigurationBuilder.initFromProperties(theSputnikProperties);
ConnectorFacade facade = getConnectorFacade(theConfiguration);
new Engine(facade, facade, theConfiguration).run();
} catch (Exception e) {
throw new MojoExecutionException("Error invoking sputnik", e);
} finally {
MavenEnvironment.cleanUp();
}
}
示例10: getUsername
import pl.touk.sputnik.configuration.CliOption; //导入依赖的package包/类
private String getUsername(Configuration configuration) {
return configuration.getProperty(CliOption.USERNAME) != null ? configuration.getProperty(
CliOption.USERNAME) : configuration.getProperty(GeneralOption.USERNAME);
}
示例11: getPassword
import pl.touk.sputnik.configuration.CliOption; //导入依赖的package包/类
private String getPassword(Configuration configuration) {
return configuration.getProperty(CliOption.PASSWORD) != null ? configuration.getProperty(
CliOption.PASSWORD) : configuration.getProperty(GeneralOption.PASSWORD);
}
示例12: addRegexFilterIfConfigured
import pl.touk.sputnik.configuration.CliOption; //导入依赖的package包/类
private void addRegexFilterIfConfigured(Configuration configuration, List<BeforeReviewVisitor> beforeReviewVisitors) {
String fileRegex = configuration.getProperty(CliOption.FILE_REGEX);
if (fileRegex != null) {
beforeReviewVisitors.add(new RegexFilterFilesVisitor(fileRegex));
}
}
示例13: setConnectorProperties
import pl.touk.sputnik.configuration.CliOption; //导入依赖的package包/类
@Override
protected void setConnectorProperties() {
setConnectorProperty(CliOption.CHANGE_ID, changeId);
setConnectorProperty(CliOption.REVISION_ID, revisionId);
}