-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1347 from forcedotcom/dev
RELEASE: @W-14914244@: Merging `dev` to `release` for v3.21.0
Showing
28 changed files
with
1,024 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
sfge/src/main/java/com/salesforce/graph/vertex/SuperVariableExpressionVertex.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.salesforce.graph.vertex; | ||
|
||
import com.salesforce.exception.UnexpectedException; | ||
import com.salesforce.graph.symbols.SymbolProvider; | ||
import com.salesforce.graph.symbols.SymbolProviderVertexVisitor; | ||
import com.salesforce.graph.visitor.PathVertexVisitor; | ||
import java.util.Map; | ||
|
||
public class SuperVariableExpressionVertex extends TODO_FIX_HIERARCHY_ChainedVertex | ||
implements Typeable { | ||
SuperVariableExpressionVertex(Map<Object, Object> properties) { | ||
this(properties, null); | ||
} | ||
|
||
SuperVariableExpressionVertex(Map<Object, Object> properties, Object supplementalParam) { | ||
super(properties, supplementalParam); | ||
} | ||
|
||
@Override | ||
public boolean visit(PathVertexVisitor visitor, SymbolProvider symbols) { | ||
return visitor.visit(this, symbols); | ||
} | ||
|
||
@Override | ||
public boolean visit(SymbolProviderVertexVisitor visitor) { | ||
return visitor.visit(this); | ||
} | ||
|
||
@Override | ||
public void afterVisit(PathVertexVisitor visitor, SymbolProvider symbols) { | ||
visitor.afterVisit(this, symbols); | ||
} | ||
|
||
@Override | ||
public void afterVisit(SymbolProviderVertexVisitor visitor) { | ||
visitor.afterVisit(this); | ||
} | ||
|
||
@Override | ||
public String getCanonicalType() { | ||
UserClassVertex parentClass = | ||
getParentClass().orElseThrow(() -> new UnexpectedException("Missing parent class")); | ||
return parentClass | ||
.getSuperClassName() | ||
.orElseThrow(() -> new UnexpectedException("Missing super class")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
import {InputProcessor, InputProcessorImpl} from "../../src/lib/InputProcessor"; | ||
import {assert, expect} from "chai"; | ||
import * as path from "path"; | ||
import {Inputs} from "../../src/types"; | ||
import {BundleName, getMessage} from "../../src/MessageCatalog"; | ||
import untildify = require("untildify"); | ||
import normalize = require("normalize-path"); | ||
import {FakeDisplay} from "./FakeDisplay"; | ||
|
||
describe("InputProcessorImpl Tests", async () => { | ||
let display: FakeDisplay; | ||
let inputProcessor: InputProcessor; | ||
beforeEach(async () => { | ||
display = new FakeDisplay(); | ||
inputProcessor = new InputProcessorImpl("2.11.8", display); | ||
}); | ||
|
||
describe("resolveTargetPaths Tests", async () => { | ||
it("Specified glob target stays as glob", async () => { | ||
// Note that we may want to change this behavior in the future instead of waiting to resolve the globs | ||
// in the DefaultRuleManager. But for now, adding this test. | ||
const inputs: Inputs = { | ||
target: ['test\\**\\*.page', '!test/code-fixtures/cpd', '~/*.class'] | ||
}; | ||
const resolvedTargetPaths: string[] = inputProcessor.resolveTargetPaths(inputs); | ||
expect(resolvedTargetPaths).to.have.length(3); | ||
expect(resolvedTargetPaths).to.contain('test/**/*.page'); | ||
expect(resolvedTargetPaths).to.contain('!test/code-fixtures/cpd'); | ||
expect(resolvedTargetPaths).to.contain(normalize(untildify('~/*.class'))) | ||
}) | ||
|
||
it("Specified target with method specifier", async () => { | ||
const inputs: Inputs = { | ||
target: ['test/code-fixtures/apex/SomeTestClass.cls#testMethodWithoutAsserts'] | ||
}; | ||
const resolvedTargetPaths: string[] = inputProcessor.resolveTargetPaths(inputs); | ||
expect(resolvedTargetPaths).to.have.length(1); | ||
expect(resolvedTargetPaths).to.contain('test/code-fixtures/apex/SomeTestClass.cls#testMethodWithoutAsserts'); | ||
|
||
expect(display.getOutputText()).to.equal('') | ||
}) | ||
|
||
it("Unspecified target resolves to current directory", async () => { | ||
const inputs: Inputs = {} | ||
const resolvedTargetPaths: string[] = inputProcessor.resolveTargetPaths(inputs); | ||
expect(resolvedTargetPaths).to.have.length(1); | ||
expect(resolvedTargetPaths).to.contain('.'); | ||
|
||
expect(display.getOutputText()).to.equal('[Info]: ' + | ||
getMessage(BundleName.CommonRun, 'info.resolvedTarget')) | ||
}) | ||
}) | ||
|
||
describe("resolveProjectDirPath Tests", async () => { | ||
it("Specified relative projectdir", async () => { | ||
const inputs: Inputs = { | ||
projectdir: ['test/code-fixtures'] | ||
}; | ||
const resolvedProjectDirs: string[] = inputProcessor.resolveProjectDirPaths(inputs); | ||
expect(resolvedProjectDirs).to.contain(toAbsPath('test/code-fixtures')) | ||
}) | ||
|
||
it("Specified absolute projectdir", async () => { | ||
const inputs: Inputs = { | ||
projectdir: [toAbsPath('test/code-fixtures')] | ||
}; | ||
const resolvedProjectDirs: string[] = inputProcessor.resolveProjectDirPaths(inputs); | ||
expect(resolvedProjectDirs).to.contain(toAbsPath('test/code-fixtures')) | ||
}) | ||
|
||
it("Specified tildified projectdir", async () => { | ||
const inputs: Inputs = { | ||
projectdir: ['~/someFolder'] | ||
}; | ||
const resolvedProjectDirs: string[] = inputProcessor.resolveProjectDirPaths(inputs); | ||
expect(resolvedProjectDirs).to.contain(toAbsPath(normalize(untildify('~/someFolder')))) | ||
}) | ||
|
||
it("Unspecified projectdir and unspecified target", async() => { | ||
const inputs: Inputs = {} | ||
const resolvedProjectDirs: string[] = inputProcessor.resolveProjectDirPaths(inputs); | ||
expect(resolvedProjectDirs).to.contain(toAbsPath('.')); | ||
|
||
expect(display.getOutputArray()).to.have.length(2) | ||
expect(display.getOutputArray()).to.contain('[Info]: ' + | ||
getMessage(BundleName.CommonRun, 'info.resolvedTarget')) | ||
expect(display.getOutputArray()).to.contain('[Info]: ' + | ||
getMessage(BundleName.CommonRun, 'info.resolvedProjectDir', [toAbsPath('')])) | ||
}) | ||
|
||
it("Unspecified projectdir with non-glob relative targets supplied", async () => { | ||
const inputs: Inputs = { | ||
target: ['test/code-fixtures/apex', 'test/catalog-fixtures/DefaultCatalogFixture.json'] | ||
}; | ||
const resolvedProjectDirs: string[] = inputProcessor.resolveProjectDirPaths(inputs); | ||
expect(resolvedProjectDirs).to.contain(toAbsPath('test')); | ||
|
||
expect(display.getOutputText()).to.equal('[Info]: ' + | ||
getMessage(BundleName.CommonRun, 'info.resolvedProjectDir', [toAbsPath('test')])) | ||
}) | ||
|
||
it("Unspecified projectdir with glob targets supplied (with sfdx-project.json in parents)", async () => { | ||
const resolvedProjectDirs: string[] = inputProcessor.resolveProjectDirPaths({ | ||
target: ['test/**/*.page', '!test/code-fixtures/cpd'] | ||
}); | ||
// Note that test/code-fixtures/projects/app/force-app/main/default/pages is the first most common parent | ||
// but test/code-fixtures/projects/app contains a sfdx-project.json and so we return this instead | ||
expect(resolvedProjectDirs).to.contain(toAbsPath('test/code-fixtures/projects/app')); | ||
}) | ||
|
||
it("Unspecified projectdir with glob targets supplied (with no sfdx-project.json in parents)", async () => { | ||
const resolvedProjectDirs: string[] = inputProcessor.resolveProjectDirPaths({ | ||
target: ['test/code-fixtures/**/*.cls'] | ||
}); | ||
expect(resolvedProjectDirs).to.contain(toAbsPath('test/code-fixtures')); | ||
}) | ||
|
||
it("Unspecified projectdir with target containing method specifiers", async () => { | ||
const resolvedProjectDirs: string[] = inputProcessor.resolveProjectDirPaths({ | ||
target: [ | ||
'test/code-fixtures/apex/SomeTestClass.cls#testMethodWithoutAsserts', | ||
'test/code-fixtures/apex/SomeOtherTestClass.cls#someTestMethodWithoutAsserts', | ||
] | ||
}); | ||
expect(resolvedProjectDirs).to.contain(toAbsPath('test/code-fixtures/apex')); | ||
}) | ||
|
||
it("Unspecified projectdir with non-glob target that resolves to no files", async () => { | ||
const inputs: Inputs = { | ||
target: ['thisFileDoesNotExist.xml', 'thisFileAlsoDoesNotExist.json'] | ||
}; | ||
try { | ||
inputProcessor.resolveProjectDirPaths(inputs); | ||
assert.fail("Expected error to be thrown") | ||
} catch (e) { | ||
expect(e.message).to.equal(getMessage(BundleName.CommonRun, 'validations.noFilesFoundInTarget')); | ||
} | ||
}) | ||
|
||
it("Unspecified projectdir with glob target that resolves to no files", async () => { | ||
const inputs: Inputs = { | ||
target: ['**.filesOfThisTypeShouldNotExist'] | ||
}; | ||
try { | ||
inputProcessor.resolveProjectDirPaths(inputs); | ||
assert.fail("Expected error to be thrown") | ||
} catch (e) { | ||
expect(e.message).to.equal(getMessage(BundleName.CommonRun, 'validations.noFilesFoundInTarget')); | ||
} | ||
}) | ||
}) | ||
}) | ||
|
||
function toAbsPath(fileOrFolder: string): string { | ||
return path.resolve(fileOrFolder) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters