Mercurial > hg > mercurial
annotate mercurial-tests/src/jetbrains/buildServer/buildTriggers/vcs/mercurial/ExtensionsTest.java @ 1027:10dc26b32c35
Update code according to new Java
author | nikolai.kulakov@DESKTOP-Q4QCGIH |
---|---|
date | Wed, 05 Aug 2020 13:19:53 +0300 |
parents | 7bf4d943d5bb |
children |
rev | line source |
---|---|
775 | 1 /* |
976 | 2 * Copyright 2000-2018 JetBrains s.r.o. |
775 | 3 * |
4 * Licensed under the Apache License, Version 2.0 (the "License"); | |
5 * you may not use this file except in compliance with the License. | |
6 * You may obtain a copy of the License at | |
7 * | |
8 * http://www.apache.org/licenses/LICENSE-2.0 | |
9 * | |
10 * Unless required by applicable law or agreed to in writing, software | |
11 * distributed under the License is distributed on an "AS IS" BASIS, | |
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 * See the License for the specific language governing permissions and | |
14 * limitations under the License. | |
15 */ | |
16 | |
17 package jetbrains.buildServer.buildTriggers.vcs.mercurial; | |
18 | |
19 import jetbrains.buildServer.vcs.VcsException; | |
20 import jetbrains.buildServer.vcs.VcsRoot; | |
21 import junit.framework.Assert; | |
22 import org.jetbrains.annotations.NotNull; | |
23 import org.testng.annotations.Test; | |
24 | |
25 import java.io.File; | |
26 import java.io.IOException; | |
27 | |
28 import static jetbrains.buildServer.buildTriggers.vcs.mercurial.MercurialSupportBuilder.mercurialSupport; | |
29 import static jetbrains.buildServer.buildTriggers.vcs.mercurial.ServerPluginConfigBuilder.serverPluginConfig; | |
30 import static jetbrains.buildServer.buildTriggers.vcs.mercurial.VcsRootBuilder.vcsRoot; | |
31 | |
32 /** | |
33 * Created 25.02.14 13:17 | |
34 * | |
35 * @author Eugene Petrenko (eugene.petrenko@jetbrains.com) | |
36 */ | |
37 @RequiredHgVersion(min = "2.0.0") | |
38 public class ExtensionsTest extends BaseMercurialTestCase { | |
39 | |
40 @Test(dataProviderClass = HgVersionConstraint.class, dataProvider = "installedHgVersion") | |
1027
10dc26b32c35
Update code according to new Java
nikolai.kulakov@DESKTOP-Q4QCGIH
parents:
976
diff
changeset
|
41 public void test_no_extension(HgVersion version) throws IOException, VcsException { |
775 | 42 String extension = "HGExtensionThatDoesNotExits"; |
43 | |
44 try { | |
45 runWithExtensions(extension); | |
46 Assert.fail(); | |
47 } catch (VcsException e) { | |
48 Assert.assertTrue(e.getMessage().contains(extension)); | |
49 } | |
50 } | |
51 | |
52 @Test(dataProviderClass = HgVersionConstraint.class, dataProvider = "installedHgVersion") | |
1027
10dc26b32c35
Update code according to new Java
nikolai.kulakov@DESKTOP-Q4QCGIH
parents:
976
diff
changeset
|
53 public void test_extension(HgVersion version) throws IOException, VcsException { |
775 | 54 runWithExtensions("mq", "largefiles"); |
55 } | |
56 | |
57 private void runWithExtensions(@NotNull String... extensions) throws IOException, VcsException { | |
58 ServerPluginConfig config = serverPluginConfig() | |
59 .cachesDir(myTempFiles.createTempDir()) | |
60 .hgPath(Util.getHgPath()) | |
61 .build(); | |
62 | |
63 final File myRemoteRepository = myTempFiles.createTempDir(); | |
64 Util.copyRepository(new File("mercurial-tests/testData/rep2"), myRemoteRepository); | |
65 | |
66 | |
67 final MercurialSupportBuilder hgBuilder = mercurialSupport().withConfig(config); | |
68 final MercurialVcsSupport vcs = hgBuilder.build(); | |
69 final VcsRoot root = vcsRoot().withUrl(myRemoteRepository.getAbsolutePath()).withBranch("default").withExtensions(extensions).build(); | |
70 | |
71 vcs.getCollectChangesPolicy().getCurrentState(root); | |
72 vcs.getTestConnectionSupport().testConnection(root); | |
73 } | |
74 | |
75 | |
76 } |