boolean check()

in src/it/include-artifact-simple/verify.groovy [21:66]


    boolean check() {
        // Check folder and file existence

        String group = "org.apache.sling";
        String groupPath = group.replaceAll("\\.", "/");
        String artifact = "slingfeature-maven-plugin-test-include-artifact-simple";
        String version = "1.0.0-SNAPSHOT";
        File localMavenRepositoryInstallationFolder = new File(
            localRepositoryPath, groupPath + "/" + artifact + "/" + version
        );
        if(!localMavenRepositoryInstallationFolder.exists()) {
            System.out.println("Installation Folder does not exist: " + localMavenRepositoryInstallationFolder);
            return false;
        }

        String classifier = "test";
        String extension = "slingosgifeature";
        File fmDescriptorFile = new File(
            localMavenRepositoryInstallationFolder, artifact + "-" + version + "-" + classifier + "." + extension
        );
        if(!fmDescriptorFile.exists()) {
            System.out.println("FM Descriptor file does not exist: " + fmDescriptorFile);
            return false;
        }

        // Check FM Descriptor Content
        String fmContent = FileUtils.fileRead(fmDescriptorFile);
        System.out.println("FM Descriptor File Content: " + fmContent);
        String dependentGroup = "org.codehaus.janino";
        String dependentArtifact = "janino";
        String dependentVersion = "2.7.5";
        String[] values = [
            "\"id\":\"" + group + ":" + artifact + ":slingosgifeature:" + classifier + ":" + version + "\"",
            "\"bundles\":[",
            group + ":" + artifact + ":" + version + "\"",
            dependentGroup + ":" + dependentArtifact + ":" + dependentVersion + "\"",
        ];
        for (String value : values) {
            if (fmContent.indexOf(value) < 0) {
                System.out.println("Did not find line: " + value + " -> FAILED!");
                return false;
            }
        }

        return true;
    }