本文整理汇总了Java中org.jvnet.hudson.test.WithoutJenkins类的典型用法代码示例。如果您正苦于以下问题:Java WithoutJenkins类的具体用法?Java WithoutJenkins怎么用?Java WithoutJenkins使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WithoutJenkins类属于org.jvnet.hudson.test包,在下文中一共展示了WithoutJenkins类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testImageUrl
import org.jvnet.hudson.test.WithoutJenkins; //导入依赖的package包/类
@Issue({"JENKINS-48674"})
@WithoutJenkins
@Test
public void testImageUrl() throws MalformedURLException {
assertEquals(new URL("https://get.docker.com/builds/Linux/x86_64/docker-1.10.0"), DockerToolInstaller.getDockerImageUrl("linux/x86_64", "1.10.0"));
assertEquals(new URL("https://get.docker.com/builds/Windows/x86_64/docker-1.10.0"), DockerToolInstaller.getDockerImageUrl("win/x86_64","1.10.0"));
assertEquals(new URL("https://get.docker.com/builds/Darwin/x86_64/docker-1.10.0"), DockerToolInstaller.getDockerImageUrl("mac/x86_64","1.10.0"));
assertEquals(new URL("https://get.docker.com/builds/Linux/x86_64/docker-17.05.0-ce"), DockerToolInstaller.getDockerImageUrl("linux/x86_64", "17.05.0-ce"));
assertEquals(new URL("https://get.docker.com/builds/Windows/x86_64/docker-17.05.0-ce"), DockerToolInstaller.getDockerImageUrl("win/x86_64","17.05.0-ce"));
assertEquals(new URL("https://get.docker.com/builds/Darwin/x86_64/docker-17.05.0-ce"), DockerToolInstaller.getDockerImageUrl("mac/x86_64","17.05.0-ce"));
assertEquals(new URL("https://get.docker.com/builds/Linux/x86_64/docker-latest"), DockerToolInstaller.getDockerImageUrl("linux/x86_64", "latest"));
assertEquals(new URL("https://get.docker.com/builds/Windows/x86_64/docker-latest"), DockerToolInstaller.getDockerImageUrl("win/x86_64","latest"));
assertEquals(new URL("https://get.docker.com/builds/Darwin/x86_64/docker-latest"), DockerToolInstaller.getDockerImageUrl("mac/x86_64","latest"));
assertEquals(new URL("https://download.docker.com/linux/static/edge/x86_64/docker-17.09.0-ce"), DockerToolInstaller.getDockerImageUrl("linux/x86_64", "17.09.0-ce"));
assertEquals(new URL("https://download.docker.com/win/static/edge/x86_64/docker-17.09.0-ce"), DockerToolInstaller.getDockerImageUrl("win/x86_64","17.09.0-ce"));
assertEquals(new URL("https://download.docker.com/mac/static/edge/x86_64/docker-17.09.0-ce"), DockerToolInstaller.getDockerImageUrl("mac/x86_64","17.09.0-ce"));
}
示例2: testSplit
import org.jvnet.hudson.test.WithoutJenkins; //导入依赖的package包/类
@Test
@WithoutJenkins
public void testSplit() throws Exception {
assertArrayEquals(DownloadStep.split("a"), new String[] {"a"});
assertArrayEquals(DownloadStep.split("asdjfkl2358/9/[email protected]#[email protected]%^$#^#"),
new String[] {"asdjfkl2358/9/[email protected]#[email protected]%^$#^#"});
assertArrayEquals(DownloadStep.split("a*"), new String[] {"a", ""});
assertArrayEquals(DownloadStep.split("*"), new String[] {"", ""});
assertArrayEquals(DownloadStep.split("pre-*-post"),
new String[] {"pre-", "-post"});
// Not yet supported
checkSplitException("**");
checkSplitException("a**");
checkSplitException("a*b*c");
checkSplitException("a/*b/*c");
}
示例3: testGetters
import org.jvnet.hudson.test.WithoutJenkins; //导入依赖的package包/类
@Test
@WithoutJenkins
public void testGetters() {
final boolean sharedPublicly = false;
final boolean forFailedJobs = true;
final boolean showInline = true;
final String pathPrefix = null;
FakeUpload underTest = new FakeUpload(BUCKET_URI,
sharedPublicly, forFailedJobs, showInline, pathPrefix,
new MockUploadModule(executor),
FAKE_DETAILS,
null /* uploads */);
assertEquals(BUCKET_URI, underTest.getBucket());
assertEquals(sharedPublicly, underTest.isSharedPublicly());
assertEquals(forFailedJobs, underTest.isForFailedJobs());
assertEquals(showInline, underTest.isShowInline());
}
示例4: doCheckBucketTest
import org.jvnet.hudson.test.WithoutJenkins; //导入依赖的package包/类
@Test
@WithoutJenkins
public void doCheckBucketTest() throws IOException {
DescriptorImpl descriptor = new DescriptorImpl();
assertEquals(FormValidation.Kind.OK,
descriptor.doCheckBucketNameWithVars("gs://asdf").kind);
// Successfully resolved
assertEquals(FormValidation.Kind.OK,
descriptor.doCheckBucketNameWithVars("gs://asdf$BUILD_NUMBER").kind);
// UN-successfully resolved
assertEquals(FormValidation.Kind.ERROR,
descriptor.doCheckBucketNameWithVars("gs://$foo").kind);
// Escaped $BUILD_NUMBER
assertEquals(FormValidation.Kind.ERROR,
descriptor.doCheckBucketNameWithVars("gs://$$BUILD_NUMBER").kind);
// Empty
assertEquals(FormValidation.Kind.ERROR,
descriptor.doCheckBucketNameWithVars("").kind);
// Not a gs:// URI
assertEquals(FormValidation.Kind.ERROR,
descriptor.doCheckBucketNameWithVars("foo").kind);
}
示例5: testLegacyArgs
import org.jvnet.hudson.test.WithoutJenkins; //导入依赖的package包/类
@Test
@WithoutJenkins
public void testLegacyArgs() {
ClassicUpload legacyVersion = new ClassicUpload(null /* bucket */,
new MockUploadModule(executor), null /* glob */, bucket, glob);
legacyVersion.setSharedPublicly(sharedPublicly);
legacyVersion.setForFailedJobs(forFailedJobs);
legacyVersion.setShowInline(showInline);
legacyVersion.setPathPrefix(pathPrefix);
assertEquals(underTest.getBucket(), legacyVersion.getBucket());
assertEquals(underTest.isSharedPublicly(),
legacyVersion.isSharedPublicly());
assertEquals(underTest.isForFailedJobs(), legacyVersion.isForFailedJobs());
assertEquals(underTest.getPattern(), legacyVersion.getPattern());
}
示例6: doCheckGlobTest
import org.jvnet.hudson.test.WithoutJenkins; //导入依赖的package包/类
@Test
@WithoutJenkins
public void doCheckGlobTest() throws IOException {
DescriptorImpl descriptor = new DescriptorImpl();
assertEquals(FormValidation.Kind.OK,
descriptor.doCheckPattern("asdf").kind);
// Some good sample globs we should accept
assertEquals(FormValidation.Kind.OK,
descriptor.doCheckPattern("target/*.war").kind);
assertEquals(FormValidation.Kind.OK,
descriptor.doCheckPattern("**/target/foo.*").kind);
// Successfully resolved
assertEquals(FormValidation.Kind.OK,
descriptor.doCheckPattern("asdf$BUILD_NUMBER").kind);
// UN-successfully resolved
assertEquals(FormValidation.Kind.ERROR,
descriptor.doCheckPattern("$foo").kind);
// Escaped $BUILD_NUMBER
assertEquals(FormValidation.Kind.ERROR,
descriptor.doCheckPattern("$$BUILD_NUMBER").kind);
}
示例7: testJobPluginTextInJob
import org.jvnet.hudson.test.WithoutJenkins; //导入依赖的package包/类
@Test
@WithoutJenkins
public void testJobPluginTextInJob() {
final String jsonText = "{ \"here\": \"i am\"}";
PackerPublisher plugin = new PackerPublisher(name,
jsonProjectTemplate, jsonText, PLUGIN_HOME,
localParams, emptyFileEntries, false, null);
assertEquals(PLUGIN_HOME, plugin.getPackerHome());
// text in job initialization
plugin.setTemplateMode(TemplateMode.TEXT.toMode());
assertEquals(localParams, plugin.getParams());
assertFalse(plugin.isFileTemplate());
assertFalse(plugin.isGlobalTemplate());
assertTrue(plugin.isTextTemplate());
assertEquals(jsonText, plugin.getJsonTemplateText());
}
示例8: testJobPluginFileInJob
import org.jvnet.hudson.test.WithoutJenkins; //导入依赖的package包/类
@Test
@WithoutJenkins
public void testJobPluginFileInJob() {
final String jsonFile = "somefile.json";
PackerPublisher plugin = new PackerPublisher(name,
jsonFile, "{ \"here\": \"i am\"}", PLUGIN_HOME,
localParams, emptyFileEntries, false, null);
assertEquals(PLUGIN_HOME, plugin.getPackerHome());
// text in job initialization
plugin.setTemplateMode(TemplateMode.FILE.toMode());
assertEquals(localParams, plugin.getParams());
assertFalse(plugin.isTextTemplate());
assertFalse(plugin.isGlobalTemplate());
assertTrue(plugin.isFileTemplate());
assertEquals(jsonFile, plugin.getJsonTemplate());
}
示例9: fromGitSCMFilter
import org.jvnet.hudson.test.WithoutJenkins; //导入依赖的package包/类
@Test
@WithoutJenkins
public void fromGitSCMFilter() {
AbstractGitSCMSource git = EasyMock.createMock(AbstractGitSCMSource.class);
EasyMock.expect(git.getIncludes())
.andReturn("").times(1)
.andReturn("").times(1)
.andReturn("*/master */feature-branch").times(1)
.andReturn("*/master").anyTimes();
EasyMock.replay(git);
assertTrue(git.getIncludes().isEmpty());
assertEquals("", BitbucketBuildFilter.filterFromGitSCMSource(git, ""));
assertEquals("d:master d:feature-branch", BitbucketBuildFilter.filterFromGitSCMSource(git, ""));
assertEquals("d:master", BitbucketBuildFilter.filterFromGitSCMSource(git, ""));
}
开发者ID:nishio-dens,项目名称:bitbucket-pullrequest-builder-plugin,代码行数:17,代码来源:BitbucketBuildFilterTest.java
示例10: testForRemote
import org.jvnet.hudson.test.WithoutJenkins; //导入依赖的package包/类
@Test
@WithoutJenkins
public void testForRemote() throws Exception {
FakeGoogleCredentials credentials = new FakeGoogleCredentials(PROJECT_ID,
fakeCredential);
fakeCredential.setAccessToken(ACCESS_TOKEN);
fakeCredential.setExpiresInSeconds(EXPIRATION_SECONDS);
GoogleOAuth2ScopeRequirement requirement =
new GoogleOAuth2ScopeRequirement() {
@Override
public Collection<String> getScopes() {
return ImmutableList.of();
}
};
GoogleRobotCredentials remotable = credentials.forRemote(requirement);
assertEquals(USERNAME, remotable.getUsername());
assertEquals(ACCESS_TOKEN, Secret.toString(
remotable.getAccessToken(requirement)));
assertSame(remotable, remotable.forRemote(requirement));
}
示例11: accessTokenTest
import org.jvnet.hudson.test.WithoutJenkins; //导入依赖的package包/类
@Test
@WithoutJenkins
public void accessTokenTest() throws Exception {
final Module module = new Module();
GoogleRobotMetadataCredentials newCreds =
new GoogleRobotMetadataCredentials(PROJECT_ID, module);
Credential cred = newCreds.getGoogleCredential(
new TestGoogleOAuth2DomainRequirement(FAKE_SCOPE));
module.stubRequest(METADATA_ENDPOINT, STATUS_CODE_OK,
"{\"access_token\":\"" + ACCESS_TOKEN + "\","
+ "\"expires_in\":1234,"
+ "\"token_type\":\"Bearer\"}");
try {
assertTrue(cred.refreshToken());
assertEquals(ACCESS_TOKEN, cred.getAccessToken());
} finally {
module.verifyRequest(METADATA_ENDPOINT);
}
}
示例12: testProjectAction_setBranchSameBranch
import org.jvnet.hudson.test.WithoutJenkins; //导入依赖的package包/类
@Test
@WithoutJenkins
public void testProjectAction_setBranchSameBranch() throws Exception {
when(mockProject.getBranch()).thenReturn(mockBranch);
when(mockBranch.getHead()).thenReturn(mockHead);
when(mockBranch.getSourceId()).thenReturn(SOURCE_ID);
assertSame(mockProject, underTest.setBranch(mockProject, mockBranch));
verify(mockProject, times(1)).getBranch();
verify(mockProject).setBranch(mockBranch);
verifyNoMoreInteractions(mockProject);
verifyNoMoreInteractions(mockBranch);
verifyNoMoreInteractions(mockHead);
}
示例13: testProjectAction_setBranchExceptionSaving
import org.jvnet.hudson.test.WithoutJenkins; //导入依赖的package包/类
@Test
@WithoutJenkins
public void testProjectAction_setBranchExceptionSaving() throws Exception {
// We cannot mock 'equals', so stub it out to false.
Branch oldBranch = new Branch(SOURCE_ID, mockHead, null /* scm */,
ImmutableList.<BranchProperty>of()) {
@Override
public boolean equals(Object o) {
return false;
}
};
when(mockProject.getBranch()).thenReturn(oldBranch);
when(mockBranch.getHead()).thenReturn(mockHead);
when(mockBranch.getSourceId()).thenReturn(SOURCE_ID);
// TODO(mattmoor): any way to verify that this gets logged?
doThrow(new IOException("bleh")).when(mockProject).save();
// Make sure it doesn't die.
assertSame(mockProject, underTest.setBranch(mockProject, mockBranch));
}
示例14: getDescriptionShouldSetSuperDescriptionIfNotSet
import org.jvnet.hudson.test.WithoutJenkins; //导入依赖的package包/类
@Test
@WithoutJenkins
public void getDescriptionShouldSetSuperDescriptionIfNotSet() {
DeliveryPipelineView view = mock(DeliveryPipelineView.class);
doCallRealMethod().when(view).getDescription();
doCallRealMethod().when(view).setDescription(anyString());
String description = view.getDescription();
verify(view, times(1)).setDescription(anyString());
assertNull(description);
String expectedDescription = "some description";
view.setDescription(expectedDescription);
assertNotNull(view.getDescription());
assertThat(view.getDescription(), is(expectedDescription));
verify(view, times(2)).setDescription(anyString());
view.getDescription();
verify(view, times(2)).setDescription(anyString());
}
示例15: testEqualsHashCode
import org.jvnet.hudson.test.WithoutJenkins; //导入依赖的package包/类
@Test
@WithoutJenkins
@SuppressWarnings("all")
public void testEqualsHashCode() {
UserInfo userInfo1 = new UserInfo("name", null);
assertTrue(userInfo1.equals(userInfo1));
UserInfo userInfo2 = new UserInfo("name", "http://nowhere.com");
assertTrue(userInfo2.equals(userInfo1));
assertFalse(userInfo2.equals(null));
assertFalse(userInfo2.equals("name"));
UserInfo userInfo3 = new UserInfo("name1", "http://nowhere.com");
assertEquals(userInfo1.hashCode(), userInfo2.hashCode());
assertNotEquals(userInfo1.hashCode(), userInfo3.hashCode());
assertNotEquals(userInfo1, userInfo3);
}