test_class.file: plugins/cameraserver/src/test/java/edu/wpi/first/shuffleboard/plugin/cameraserver/source/CameraUrlGeneratorTest.java
test_class.identifier: CameraUrlGeneratorTest
test_case.body: @Test
    public void testGenerateUrlsNI() {
      String cameraName = "IMAQdx:Microsoft LifeCam HD-3000";
      Map<String, String> commands = new HashMap<>();
      commands.put("name", cameraName);
      String url1 = "http://roborio-0000-frc.local:1181/IMAQdxStream.mjpg";
      String url2 = "http://10.0.0.2:1181/IMAQdxStream.mjpg";
      String[] baseUrls = {url1, url2};
  
  
      String[] baseUrlsWithNames = Arrays.stream(baseUrls).map(x -> x + "?name=cam0").toArray(String[]::new);
      String[] baseUrlsWithCameraNames = Arrays.stream(baseUrls)
          .map(x -> x + "?name=IMAQdx%3AMicrosoft%20LifeCam%20HD-3000")
          .toArray(String[]::new);
  
      assertArrayEquals(baseUrlsWithCameraNames, CameraUrlGenerator.generateUrls(commands, baseUrlsWithNames),
          "Name should be replaced");
    }
test_case.class_method_signature: CameraUrlGeneratorTest.testGenerateUrlsNI()
test_case.full_signature: @Test public void testGenerateUrlsNI()
test_case.identifier: testGenerateUrlsNI
test_case.invocations: put toArray map stream toArray map stream assertArrayEquals generateUrls
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGenerateUrlsNI()
focal_class.declarator: source
focal_class.modifier: private final
focal_class.original_string: private final CameraServerSource source;
focal_class.type: CameraServerSource
focal_class.var_name: source
focal_class.file: plugins/cameraserver/src/main/java/edu/wpi/first/shuffleboard/plugin/cameraserver/source/CameraUrlGenerator.java
focal_class.identifier: CameraUrlGenerator
focal_class.class_method_signature: CameraUrlGenerator.CameraUrlGenerator(CameraServerSource source)
focal_class.full_signature: public  CameraUrlGenerator(CameraServerSource source)
focal_class.identifier: CameraUrlGenerator
focal_class.modifiers: public
focal_class.parameters: (CameraServerSource source)
focal_class.signature:  CameraUrlGenerator(CameraServerSource source)
focal_class.class_method_signature: CameraUrlGenerator.generateUrls(String[] baseUrls)
focal_class.full_signature: public String[] generateUrls(String[] baseUrls)
focal_class.identifier: generateUrls
focal_class.modifiers: public
focal_class.parameters: (String[] baseUrls)
focal_class.return: String[]
focal_class.signature: String[] generateUrls(String[] baseUrls)
focal_class.class_method_signature: CameraUrlGenerator.generateUrls(Map<String, String> commands, String[] baseUrls)
focal_class.full_signature: @VisibleForTesting static String[] generateUrls(Map<String, String> commands, String[] baseUrls)
focal_class.identifier: generateUrls
focal_class.modifiers: @VisibleForTesting static
focal_class.parameters: (Map<String, String> commands, String[] baseUrls)
focal_class.return: String[]
focal_class.signature: String[] generateUrls(Map<String, String> commands, String[] baseUrls)
focal_class.class_method_signature: CameraUrlGenerator.addHttpParams(String input, Map<String, String> commands)
focal_class.full_signature: @VisibleForTesting static String addHttpParams(String input, Map<String, String> commands)
focal_class.identifier: addHttpParams
focal_class.modifiers: @VisibleForTesting static
focal_class.parameters: (String input, Map<String, String> commands)
focal_class.return: String
focal_class.signature: String addHttpParams(String input, Map<String, String> commands)
focal_class.class_method_signature: CameraUrlGenerator.encodeUri(URI uri, String queryStr)
focal_class.full_signature: private static String encodeUri(URI uri, String queryStr)
focal_class.identifier: encodeUri
focal_class.modifiers: private static
focal_class.parameters: (URI uri, String queryStr)
focal_class.return: String
focal_class.signature: String encodeUri(URI uri, String queryStr)
focal_class.class_method_signature: CameraUrlGenerator.httpUrlEncode(Map.Entry<String, String> rawCommand)
focal_class.full_signature: private static String httpUrlEncode(Map.Entry<String, String> rawCommand)
focal_class.identifier: httpUrlEncode
focal_class.modifiers: private static
focal_class.parameters: (Map.Entry<String, String> rawCommand)
focal_class.return: String
focal_class.signature: String httpUrlEncode(Map.Entry<String, String> rawCommand)
focal_method.body: public String[] generateUrls(String[] baseUrls) { // NOPMD varargs instead of array
      Map<String, String> commands = new LinkedHashMap<>();
      Resolution resolution = source.getTargetResolution();
      if (resolution != null && resolution.getWidth() > 0 && resolution.getHeight() > 0) {
        commands.put("resolution", resolution.getWidth() + "x" + resolution.getHeight());
      }
      int compression = source.getTargetCompression();
      if (compression >= 0 && compression <= 100) {
        commands.put("compression", Integer.toString(compression));
      }
      int frameRate = source.getTargetFps();
      if (frameRate > 0) {
        commands.put("fps", Integer.toString(frameRate));
      }
      // Add a special case command for NI Cameras
      if (source.getName().contains("IMAQdx")) {
        commands.put("name", source.getName());
      }
      return generateUrls(commands, baseUrls);
    }
focal_method.class_method_signature: CameraUrlGenerator.generateUrls(String[] baseUrls)
focal_method.full_signature: public String[] generateUrls(String[] baseUrls)
focal_method.identifier: generateUrls
focal_method.invocations: getTargetResolution getWidth getHeight put getWidth getHeight getTargetCompression put toString getTargetFps put toString contains getName put getName generateUrls
focal_method.modifiers: public
focal_method.parameters: (String[] baseUrls)
focal_method.return: String[]
focal_method.signature: String[] generateUrls(String[] baseUrls)