IntelFpgaOpenclPlugin implements AbstractFpgaVendorPlugin { @Override public String retrieveIPfilePath(String id, String dstDir, Map<Path, List<String>> localizedResources) { String ipFilePath = null; LOG.info("Got environment: " + id + ", search IP file in localized resources"); if (null == id || id.isEmpty()) { LOG.warn("IP_ID environment is empty, skip downloading"); return null; } if (localizedResources != null) { Optional<Path> aocxPath = localizedResources .keySet() .stream() .filter(path -> matchesIpid(path, id)) .findFirst(); if (aocxPath.isPresent()) { ipFilePath = aocxPath.get().toString(); LOG.info("Found: {}", ipFilePath); } else { LOG.warn("Requested IP file not found"); } } else { LOG.warn("Localized resource is null!"); } return ipFilePath; } IntelFpgaOpenclPlugin(); String getDefaultPathToExecutable(); @Override boolean initPlugin(Configuration config); @Override List<FpgaDevice> discover(int timeout); String getDiagnoseInfo(int timeout); @Override boolean diagnose(int timeout); @Override String getFpgaType(); @Override String retrieveIPfilePath(String id, String dstDir,
      Map<Path, List<String>> localizedResources); @Override boolean configureIP(String ipPath, FpgaDevice device);  }
@Test public void testLocalizedIPfileFound() { Map<Path, List<String>> resources = createResources(); String path = plugin.retrieveIPfilePath("fpga", "workDir", resources); assertEquals("Retrieved IP file path", "/test/fpga.aocx", path); }
@Test public void testLocalizedIPfileNotFound() { Map<Path, List<String>> resources = createResources(); String path = plugin.retrieveIPfilePath("dummy", "workDir", resources); assertNull("Retrieved IP file path", path); }
@Test public void testLocalizedIpfileNotFoundWithNoLocalResources() { String path = plugin.retrieveIPfilePath("fpga", "workDir", null); assertNull("Retrieved IP file path", path); }
@Test public void testIPfileNotDefined() { Map<Path, List<String>> resources = createResources(); String path = plugin.retrieveIPfilePath(null, "workDir", resources); assertNull("Retrieved IP file path", path); }