Skip to content

Commit

Permalink
Merge 62b5e67 into 53bb45e
Browse files Browse the repository at this point in the history
  • Loading branch information
crowleySynopsys committed Mar 9, 2020
2 parents 53bb45e + 62b5e67 commit 694e1a2
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 214 deletions.

This file was deleted.

@@ -0,0 +1,91 @@
package com.synopsys.integration.detectable.detectables.swift.functional;

import java.io.File;
import java.io.IOException;
import java.nio.file.Paths;

import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.Assertions;

import com.synopsys.integration.bdio.model.Forge;
import com.synopsys.integration.detectable.Detectable;
import com.synopsys.integration.detectable.DetectableEnvironment;
import com.synopsys.integration.detectable.Extraction;
import com.synopsys.integration.detectable.detectable.exception.DetectableException;
import com.synopsys.integration.detectable.detectable.executable.ExecutableOutput;
import com.synopsys.integration.detectable.detectable.executable.resolver.SwiftResolver;
import com.synopsys.integration.detectable.functional.DetectableFunctionalTest;
import com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert;

public class SwiftDetectableTest extends DetectableFunctionalTest {

public SwiftDetectableTest() throws IOException {
super("swift");
}

@Override
protected void setup() throws IOException {

addFile(Paths.get("Package.swift"));

ExecutableOutput rootSwiftPackage = createStandardOutput(
"Fetching https://github.com/apple/example-package-fisheryates.git",
"Completed resolution in 1.03s",
"Cloning https://github.com/apple/example-package-fisheryates.git",
"Resolving https://github.com/apple/example-package-fisheryates.git at 2.0.5",
"{",
" \"name\": \"DeckOfPlayingCards\",",
" \"url\": \"/Users/jakem/bazelWorkspace/sleuthifer/swift/example-package-deckofplayingcards\",",
" \"version\": \"unspecified\",",
" \"path\": \"/Users/jakem/bazelWorkspace/sleuthifer/swift/example-package-deckofplayingcards\",",
" \"dependencies\": [",
" {",
" \"name\": \"FisherYates\",",
" \"url\": \"https://github.com/apple/example-package-fisheryates.git\",",
" \"version\": \"2.0.5\",",
" \"path\": \"/Users/jakem/bazelWorkspace/sleuthifer/swift/example-package-deckofplayingcards/.build/checkouts/example-package-fisheryates\",",
" \"dependencies\": []",
" },",
" {",
" \"name\": \"PlayingCard\",",
" \"url\": \"https://github.com/apple/example-package-playingcard.git\",",
" \"version\": \"3.0.5\",",
" \"path\": \"/Users/jakem/bazelWorkspace/sleuthifer/swift/example-package-deckofplayingcards/.build/checkouts/example-package-playingcard\",",
" \"dependencies\": [",
" {",
" \"name\": \"GenericLibrary\",",
" \"url\": \"https://github.com/apple/example-package-genericLibrary.git\",",
" \"version\": \"1.0.1\",",
" \"path\": \"/Users/jakem/bazelWorkspace/sleuthifer/swift/example-package-deckofplayingcards/.build/checkouts/example-package-genericLibrary\",",
" \"dependencies\": []",
" }",
" ]",
" }",
" ]",
"}"
);
addExecutableOutput(rootSwiftPackage, "swift", "package", "show-dependencies", "--format", "json");
}

@NotNull
@Override
public Detectable create(@NotNull final DetectableEnvironment detectableEnvironment) {
return detectableFactory.createSwiftCliDetectable(detectableEnvironment, new SwiftResolver() {
@Override
public File resolveSwift() throws DetectableException {
return new File("swift");
}
});
}

@Override
public void assertExtraction(@NotNull final Extraction extraction) {
Assertions.assertNotEquals(0, extraction.getCodeLocations().size());

NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.COCOAPODS, extraction.getCodeLocations().get(0).getDependencyGraph());
graphAssert.hasRootSize(2);
graphAssert.hasRootDependency("FisherYates", "2.0.5");
graphAssert.hasRootDependency("PlayingCard", "3.0.5");
graphAssert.hasParentChildRelationship("PlayingCard", "3.0.5", "GenericLibrary", "1.0.1");
}
}

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 694e1a2

Please sign in to comment.