test_class.declarator: RULE_ID1 = "AnyCheck1"
test_class.modifier: private static final
test_class.original_string: private static final String RULE_ID1 = "AnyCheck1";
test_class.type: String
test_class.var_name: RULE_ID1
test_class.declarator: RULE_ID2 = "AnyCheck2"
test_class.modifier: private static final
test_class.original_string: private static final String RULE_ID2 = "AnyCheck2";
test_class.type: String
test_class.var_name: RULE_ID2
test_class.declarator: ruleKey1 = RuleKey.of(AnsibleCheckRepository.REPOSITORY_KEY, RULE_ID1)
test_class.modifier: private final
test_class.original_string: private final RuleKey ruleKey1 = RuleKey.of(AnsibleCheckRepository.REPOSITORY_KEY, RULE_ID1);
test_class.type: RuleKey
test_class.var_name: ruleKey1
test_class.declarator: ruleKey2 = RuleKey.of(AnsibleCheckRepository.REPOSITORY_KEY, RULE_ID2)
test_class.modifier: private final
test_class.original_string: private final RuleKey ruleKey2 = RuleKey.of(AnsibleCheckRepository.REPOSITORY_KEY, RULE_ID2);
test_class.type: RuleKey
test_class.var_name: ruleKey2
test_class.declarator: sensor
test_class.modifier: private
test_class.original_string: private AnsibleExtraSensor sensor;
test_class.type: AnsibleExtraSensor
test_class.var_name: sensor
test_class.declarator: context
test_class.modifier: private
test_class.original_string: private SensorContextTester context;
test_class.type: SensorContextTester
test_class.var_name: context
test_class.declarator: temporaryFolder = new TemporaryFolder()
test_class.modifier: @Rule
      public
test_class.original_string: @Rule
      public TemporaryFolder temporaryFolder = new TemporaryFolder();
test_class.type: TemporaryFolder
test_class.var_name: temporaryFolder
test_class.file: sonar-ansible-api/src/test/java/com/github/sbaudoin/sonar/plugins/ansible/extras/rules/AnsibleExtraSensorTest.java
test_class.identifier: AnsibleExtraSensorTest
test_case.body: @Test
      public void testCopyExtraRule() throws NoSuchMethodException, IOException, InvocationTargetException, IllegalAccessException, URISyntaxException {
          // Make the method public for test purpose
          Method method = AnsibleExtraSensor.class.getDeclaredMethod("copyExtraRule", Path.class, Path.class);
          method.setAccessible(true);
  
          Path tempDir = Files.createTempDirectory(EXTRA_RULES_TEMP_DIR);
  
          assertFalse((Boolean)method.invoke(sensor, Paths.get("src/test/resources/extra-rules/extra-rule1.foo"), tempDir));
          Path file = Paths.get(getClass().getResource("/extra-rules/extra-rule1.cmd").toURI());
          assertTrue((Boolean)method.invoke(sensor, file, tempDir));
          assertTrue(tempDir.resolve(file.toFile().getName()).toFile().exists());
          assertEquals(Files.readAllLines(file), Files.readAllLines(tempDir.resolve(file.toFile().getName())));
      }
test_case.class_method_signature: AnsibleExtraSensorTest.testCopyExtraRule()
test_case.full_signature: @Test public void testCopyExtraRule()
test_case.identifier: testCopyExtraRule
test_case.invocations: getDeclaredMethod setAccessible createTempDirectory assertFalse invoke get get toURI getResource getClass assertTrue invoke assertTrue exists toFile resolve getName toFile assertEquals readAllLines readAllLines resolve getName toFile
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testCopyExtraRule()
focal_class.declarator: EXTRA_RULES_TEMP_DIR = "ansible-lint-extra-rules"
focal_class.modifier: public static final
focal_class.original_string: public static final String EXTRA_RULES_TEMP_DIR = "ansible-lint-extra-rules";
focal_class.type: String
focal_class.var_name: EXTRA_RULES_TEMP_DIR
focal_class.declarator: EXTRA_RULES_DIR = "extra-rules"
focal_class.modifier: public static final
focal_class.original_string: public static final String EXTRA_RULES_DIR = "extra-rules";
focal_class.type: String
focal_class.var_name: EXTRA_RULES_DIR
focal_class.declarator: LOGGER = Loggers.get(AnsibleExtraSensor.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = Loggers.get(AnsibleExtraSensor.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.file: sonar-ansible-api/src/main/java/com/github/sbaudoin/sonar/plugins/ansible/extras/rules/AnsibleExtraSensor.java
focal_class.identifier: AnsibleExtraSensor
focal_class.class_method_signature: AnsibleExtraSensor.AnsibleExtraSensor(FileSystem fileSystem)
focal_class.full_signature: public  AnsibleExtraSensor(FileSystem fileSystem)
focal_class.identifier: AnsibleExtraSensor
focal_class.modifiers: public
focal_class.parameters: (FileSystem fileSystem)
focal_class.signature:  AnsibleExtraSensor(FileSystem fileSystem)
focal_class.class_method_signature: AnsibleExtraSensor.describe(SensorDescriptor descriptor)
focal_class.full_signature: @Override public void describe(SensorDescriptor descriptor)
focal_class.identifier: describe
focal_class.modifiers: @Override public
focal_class.parameters: (SensorDescriptor descriptor)
focal_class.return: void
focal_class.signature: void describe(SensorDescriptor descriptor)
focal_class.class_method_signature: AnsibleExtraSensor.execute(SensorContext context)
focal_class.full_signature: @Override public void execute(SensorContext context)
focal_class.identifier: execute
focal_class.modifiers: @Override public
focal_class.parameters: (SensorContext context)
focal_class.return: void
focal_class.signature: void execute(SensorContext context)
focal_class.class_method_signature: AnsibleExtraSensor.extractExtraRules(String extraRulesDirectory)
focal_class.full_signature: private Path extractExtraRules(String extraRulesDirectory)
focal_class.identifier: extractExtraRules
focal_class.modifiers: private
focal_class.parameters: (String extraRulesDirectory)
focal_class.return: Path
focal_class.signature: Path extractExtraRules(String extraRulesDirectory)
focal_class.class_method_signature: AnsibleExtraSensor.copyExtraRule(Path ruleFile, Path directory)
focal_class.full_signature: private boolean copyExtraRule(Path ruleFile, Path directory)
focal_class.identifier: copyExtraRule
focal_class.modifiers: private
focal_class.parameters: (Path ruleFile, Path directory)
focal_class.return: boolean
focal_class.signature: boolean copyExtraRule(Path ruleFile, Path directory)
focal_class.class_method_signature: AnsibleExtraSensor.deleteDirectory(Path directory)
focal_class.full_signature: private boolean deleteDirectory(Path directory)
focal_class.identifier: deleteDirectory
focal_class.modifiers: private
focal_class.parameters: (Path directory)
focal_class.return: boolean
focal_class.signature: boolean deleteDirectory(Path directory)
focal_class.superclass: extends AbstractAnsibleSensor
focal_method.body: private boolean copyExtraRule(Path ruleFile, Path directory) {
          LOGGER.debug("Copying rule script {} to {}", ruleFile.toString(), directory.toString());
  
          try (OutputStream resStreamOut = new FileOutputStream(directory.resolve(ruleFile.getFileName().toString()).toString())) {
              resStreamOut.write(Files.readAllBytes(ruleFile));
          } catch (IOException e) {
              LOGGER.error("Cannot extract rule " + ruleFile.toString() + " to " + directory.toString(), e);
              return false;
          }
  
          return true;
      }
focal_method.class_method_signature: AnsibleExtraSensor.copyExtraRule(Path ruleFile, Path directory)
focal_method.full_signature: private boolean copyExtraRule(Path ruleFile, Path directory)
focal_method.identifier: copyExtraRule
focal_method.invocations: debug toString toString toString resolve toString getFileName write readAllBytes error toString toString
focal_method.modifiers: private
focal_method.parameters: (Path ruleFile, Path directory)
focal_method.return: boolean
focal_method.signature: boolean copyExtraRule(Path ruleFile, Path directory)