|
| 1 | +package io.sloeber.core; |
| 2 | + |
| 3 | +import static org.junit.Assert.fail; |
| 4 | + |
| 5 | +import java.util.Arrays; |
| 6 | +import java.util.HashMap; |
| 7 | +import java.util.HashSet; |
| 8 | +import java.util.Map; |
| 9 | + |
| 10 | +import org.junit.BeforeClass; |
| 11 | +import org.junit.Test; |
| 12 | + |
| 13 | +import io.sloeber.core.api.BoardDescriptor; |
| 14 | +import io.sloeber.core.api.CodeDescriptor; |
| 15 | +import io.sloeber.core.api.PackageManager; |
| 16 | +import io.sloeber.core.api.SerialManager; |
| 17 | + |
| 18 | +@SuppressWarnings("nls") |
| 19 | +public class RegressionTestFailingOnTravis { |
| 20 | + |
| 21 | + /* |
| 22 | + * In new new installations (of the Sloeber development environment) the |
| 23 | + * installer job will trigger downloads These mmust have finished before we |
| 24 | + * can start testing |
| 25 | + */ |
| 26 | + @BeforeClass |
| 27 | + public static void WaitForInstallerToFinish() { |
| 28 | + Shared.waitForAllJobsToFinish(); |
| 29 | + SerialManager.stopNetworkScanning(); |
| 30 | + installAdditionalBoards(); |
| 31 | + } |
| 32 | + |
| 33 | + public static void installAdditionalBoards() { |
| 34 | + String[] packageUrlsToAdd = { "http://talk2arduino.wisen.com.au/master/package_talk2.wisen.com_index.json" }; |
| 35 | + PackageManager.addPackageURLs(new HashSet<>(Arrays.asList(packageUrlsToAdd)), false); |
| 36 | + if (!MySystem.getTeensyPlatform().isEmpty()) { |
| 37 | + PackageManager.addPrivateHardwarePath(MySystem.getTeensyPlatform()); |
| 38 | + } |
| 39 | + } |
| 40 | + |
| 41 | + /** |
| 42 | + * Test wether a platform json redirect is handled properly |
| 43 | + * https://github.com/jantje/arduino-eclipse-plugin/issues/393 |
| 44 | + */ |
| 45 | + @SuppressWarnings("static-method") |
| 46 | + @Test |
| 47 | + public void redirectedJson() { |
| 48 | + //this board references to arduino avr so install that one to |
| 49 | + PackageManager.installLatestPlatform("package_index.json", "arduino", "Arduino AVR Boards"); |
| 50 | + PackageManager.installLatestPlatform("package_talk2.wisen.com_index.json", "Talk2","Talk2 AVR Boards"); |
| 51 | + Map<String, String> options = new HashMap<>(); |
| 52 | + options.put("mhz", "16MHz"); |
| 53 | + BoardDescriptor boardid = PackageManager.getBoardDescriptor("package_talk2.wisen.com_index.json", "Talk2", |
| 54 | + "Talk2 AVR Boards", "whispernode", options); |
| 55 | + if (boardid == null) { |
| 56 | + fail("redirect Json "); |
| 57 | + return; |
| 58 | + } |
| 59 | + Shared.BuildAndVerify(boardid,CodeDescriptor.createDefaultIno()); |
| 60 | + } |
| 61 | +} |
0 commit comments