Merge pull request #2566 from github/koesie10/library-version
Add library versions to data extensions editor
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
|||||||
ExternalApiUsage,
|
ExternalApiUsage,
|
||||||
} from "./external-api-usage";
|
} from "./external-api-usage";
|
||||||
import { ModeledMethodType } from "./modeled-method";
|
import { ModeledMethodType } from "./modeled-method";
|
||||||
|
import { parseLibraryFilename } from "./library";
|
||||||
|
|
||||||
export function decodeBqrsToExternalApiUsages(
|
export function decodeBqrsToExternalApiUsages(
|
||||||
chunk: DecodedBqrsChunk,
|
chunk: DecodedBqrsChunk,
|
||||||
@@ -15,7 +16,8 @@ export function decodeBqrsToExternalApiUsages(
|
|||||||
const usage = tuple[0] as Call;
|
const usage = tuple[0] as Call;
|
||||||
const signature = tuple[1] as string;
|
const signature = tuple[1] as string;
|
||||||
const supported = (tuple[2] as string) === "true";
|
const supported = (tuple[2] as string) === "true";
|
||||||
const library = tuple[4] as string;
|
let library = tuple[4] as string;
|
||||||
|
let libraryVersion: string | undefined = tuple[5] as string;
|
||||||
const type = tuple[6] as ModeledMethodType;
|
const type = tuple[6] as ModeledMethodType;
|
||||||
const classification = tuple[8] as CallClassification;
|
const classification = tuple[8] as CallClassification;
|
||||||
|
|
||||||
@@ -37,9 +39,25 @@ export function decodeBqrsToExternalApiUsages(
|
|||||||
methodDeclaration.indexOf("("),
|
methodDeclaration.indexOf("("),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// For Java, we'll always get back a .jar file, and the library version may be bad because not all library authors
|
||||||
|
// properly specify the version. Therefore, we'll always try to parse the name and version from the library filename
|
||||||
|
// for Java.
|
||||||
|
if (library.endsWith(".jar") || libraryVersion === "") {
|
||||||
|
const { name, version } = parseLibraryFilename(library);
|
||||||
|
library = name;
|
||||||
|
if (version) {
|
||||||
|
libraryVersion = version;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (libraryVersion === "") {
|
||||||
|
libraryVersion = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
if (!methodsByApiName.has(signature)) {
|
if (!methodsByApiName.has(signature)) {
|
||||||
methodsByApiName.set(signature, {
|
methodsByApiName.set(signature, {
|
||||||
library,
|
library,
|
||||||
|
libraryVersion,
|
||||||
signature,
|
signature,
|
||||||
packageName,
|
packageName,
|
||||||
typeName,
|
typeName,
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ export type Usage = Call & {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export interface MethodSignature {
|
export interface MethodSignature {
|
||||||
|
/**
|
||||||
|
* Contains the version of the library if it can be determined by CodeQL, e.g. `4.2.2.2`
|
||||||
|
*/
|
||||||
|
libraryVersion?: string;
|
||||||
/**
|
/**
|
||||||
* A unique signature that can be used to identify this external API usage.
|
* A unique signature that can be used to identify this external API usage.
|
||||||
*
|
*
|
||||||
|
|||||||
58
extensions/ql-vscode/src/data-extensions-editor/library.ts
Normal file
58
extensions/ql-vscode/src/data-extensions-editor/library.ts
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
import { basename, extname } from "../common/path";
|
||||||
|
|
||||||
|
// From the semver package using
|
||||||
|
// const { re, t } = require("semver/internal/re");
|
||||||
|
// console.log(re[t.LOOSE]);
|
||||||
|
// Modifications:
|
||||||
|
// - Added version named group which does not capture the v prefix
|
||||||
|
// - Removed the ^ and $ anchors
|
||||||
|
// - Made the minor and patch versions optional
|
||||||
|
// - Added a hyphen to the start of the version
|
||||||
|
// - Added a dot as a valid separator between the version and the label
|
||||||
|
// - Made the patch version optional even if a label is given
|
||||||
|
// This will match any semver string at the end of a larger string
|
||||||
|
const semverRegex =
|
||||||
|
/-[v=\s]*(?<version>([0-9]+)(\.([0-9]+)(?:(\.([0-9]+))?(?:[-.]?((?:[0-9]+|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:[0-9]+|\d*[a-zA-Z-][a-zA-Z0-9-]*))*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?)?)?)/g;
|
||||||
|
|
||||||
|
export interface Library {
|
||||||
|
name: string;
|
||||||
|
version?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function parseLibraryFilename(filename: string): Library {
|
||||||
|
let libraryName = basename(filename);
|
||||||
|
const extension = extname(libraryName);
|
||||||
|
libraryName = libraryName.slice(0, -extension.length);
|
||||||
|
|
||||||
|
let libraryVersion: string | undefined;
|
||||||
|
|
||||||
|
let match: RegExpMatchArray | null = null;
|
||||||
|
|
||||||
|
// Reset the regex
|
||||||
|
semverRegex.lastIndex = 0;
|
||||||
|
|
||||||
|
// Find the last occurence of the regex within the library name
|
||||||
|
// eslint-disable-next-line no-constant-condition
|
||||||
|
while (true) {
|
||||||
|
const currentMatch = semverRegex.exec(libraryName);
|
||||||
|
if (currentMatch === null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
match = currentMatch;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (match?.groups) {
|
||||||
|
libraryVersion = match.groups?.version;
|
||||||
|
// Remove everything after the start of the match
|
||||||
|
libraryName = libraryName.slice(0, match.index);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove any leading or trailing hyphens or dots
|
||||||
|
libraryName = libraryName.replaceAll(/^[.-]+|[.-]+$/g, "");
|
||||||
|
|
||||||
|
return {
|
||||||
|
name: libraryName,
|
||||||
|
version: libraryVersion,
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -30,8 +30,8 @@ where
|
|||||||
usage = aUsage(api) and
|
usage = aUsage(api) and
|
||||||
type = supportedType(api) and
|
type = supportedType(api) and
|
||||||
classification = methodClassification(usage)
|
classification = methodClassification(usage)
|
||||||
select usage, apiName, supported.toString(), "supported", api.getFile().getBaseName(), "library",
|
select usage, apiName, supported.toString(), "supported", api.dllName(), api.dllVersion(), type,
|
||||||
type, "type", classification, "classification"
|
"type", classification, "classification"
|
||||||
`,
|
`,
|
||||||
frameworkModeQuery: `/**
|
frameworkModeQuery: `/**
|
||||||
* @name Public methods
|
* @name Public methods
|
||||||
@@ -111,7 +111,7 @@ class CallableMethod extends DotNet::Declaration {
|
|||||||
bindingset[this]
|
bindingset[this]
|
||||||
private string getSignature() {
|
private string getSignature() {
|
||||||
result =
|
result =
|
||||||
nestedName(this.getDeclaringType().getUnboundDeclaration()) + "." + this.getName() + "(" +
|
nestedName(this.getDeclaringType().getUnboundDeclaration()) + "#" + this.getName() + "(" +
|
||||||
parameterQualifiedTypeNamesToString(this) + ")"
|
parameterQualifiedTypeNamesToString(this) + ")"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,7 +125,23 @@ class CallableMethod extends DotNet::Declaration {
|
|||||||
* Gets the namespace and signature of this API.
|
* Gets the namespace and signature of this API.
|
||||||
*/
|
*/
|
||||||
bindingset[this]
|
bindingset[this]
|
||||||
string getApiName() { result = this.getNamespace() + "#" + this.getSignature() }
|
string getApiName() { result = this.getNamespace() + "." + this.getSignature() }
|
||||||
|
|
||||||
|
private string getDllName() { result = this.getLocation().(Assembly).getName() }
|
||||||
|
|
||||||
|
private string getDllVersion() { result = this.getLocation().(Assembly).getVersion().toString() }
|
||||||
|
|
||||||
|
string dllName() {
|
||||||
|
result = this.getDllName()
|
||||||
|
or
|
||||||
|
not exists(this.getDllName()) and result = this.getFile().getBaseName()
|
||||||
|
}
|
||||||
|
|
||||||
|
string dllVersion() {
|
||||||
|
result = this.getDllVersion()
|
||||||
|
or
|
||||||
|
not exists(this.getDllVersion()) and result = ""
|
||||||
|
}
|
||||||
|
|
||||||
/** Gets a node that is an input to a call to this API. */
|
/** Gets a node that is an input to a call to this API. */
|
||||||
private ArgumentNode getAnInput() {
|
private ArgumentNode getAnInput() {
|
||||||
@@ -195,7 +211,7 @@ string supportedType(CallableMethod method) {
|
|||||||
or
|
or
|
||||||
method.isNeutral() and result = "neutral"
|
method.isNeutral() and result = "neutral"
|
||||||
or
|
or
|
||||||
not method.isSupported() and result = "none"
|
not method.isSupported() and result = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
string methodClassification(Call method) {
|
string methodClassification(Call method) {
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ where
|
|||||||
usage = aUsage(externalApi) and
|
usage = aUsage(externalApi) and
|
||||||
type = supportedType(externalApi) and
|
type = supportedType(externalApi) and
|
||||||
classification = methodClassification(usage)
|
classification = methodClassification(usage)
|
||||||
select usage, apiName, supported.toString(), "supported", externalApi.jarContainer(), "library",
|
select usage, apiName, supported.toString(), "supported", externalApi.jarContainer(),
|
||||||
type, "type", classification, "classification"
|
externalApi.jarVersion(), type, "type", classification, "classification"
|
||||||
`,
|
`,
|
||||||
frameworkModeQuery: `/**
|
frameworkModeQuery: `/**
|
||||||
* @name Public methods
|
* @name Public methods
|
||||||
@@ -75,7 +75,7 @@ private predicate isUninteresting(Callable c) {
|
|||||||
/**
|
/**
|
||||||
* A callable method from either the Standard Library, a 3rd party library or from the source.
|
* A callable method from either the Standard Library, a 3rd party library or from the source.
|
||||||
*/
|
*/
|
||||||
class CallableMethod extends Method {
|
class CallableMethod extends Callable {
|
||||||
CallableMethod() { not isUninteresting(this) }
|
CallableMethod() { not isUninteresting(this) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -91,6 +91,10 @@ class CallableMethod extends Method {
|
|||||||
result = this.getCompilationUnit().getParentContainer*().(JarFile).getBaseName()
|
result = this.getCompilationUnit().getParentContainer*().(JarFile).getBaseName()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string getJarVersion() {
|
||||||
|
result = this.getCompilationUnit().getParentContainer*().(JarFile).getSpecificationVersion()
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the jar file containing this API. Normalizes the Java Runtime to "rt.jar" despite the presence of modules.
|
* Gets the jar file containing this API. Normalizes the Java Runtime to "rt.jar" despite the presence of modules.
|
||||||
*/
|
*/
|
||||||
@@ -100,6 +104,15 @@ class CallableMethod extends Method {
|
|||||||
not exists(this.getJarName()) and result = "rt.jar"
|
not exists(this.getJarName()) and result = "rt.jar"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the version of the JAR file containing this API. Empty if no version is found in the JAR.
|
||||||
|
*/
|
||||||
|
string jarVersion() {
|
||||||
|
result = this.getJarVersion()
|
||||||
|
or
|
||||||
|
not exists(this.getJarVersion()) and result = ""
|
||||||
|
}
|
||||||
|
|
||||||
/** Gets a node that is an input to a call to this API. */
|
/** Gets a node that is an input to a call to this API. */
|
||||||
private DataFlow::Node getAnInput() {
|
private DataFlow::Node getAnInput() {
|
||||||
exists(Call call | call.getCallee().getSourceDeclaration() = this |
|
exists(Call call | call.getCallee().getSourceDeclaration() = this |
|
||||||
@@ -160,7 +173,7 @@ string supportedType(CallableMethod method) {
|
|||||||
or
|
or
|
||||||
method.isNeutral() and result = "neutral"
|
method.isNeutral() and result = "neutral"
|
||||||
or
|
or
|
||||||
not method.isSupported() and result = "none"
|
not method.isSupported() and result = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
string methodClassification(Call method) {
|
string methodClassification(Call method) {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export type Query = {
|
|||||||
* - supported: whether the external API is modeled. This should be a string representation of a boolean to satify the result pattern for a problem query.
|
* - supported: whether the external API is modeled. This should be a string representation of a boolean to satify the result pattern for a problem query.
|
||||||
* - "supported": a string literal. This is required to make the query a valid problem query.
|
* - "supported": a string literal. This is required to make the query a valid problem query.
|
||||||
* - libraryName: the name of the library that contains the external API. This is a string and usually the basename of a file.
|
* - libraryName: the name of the library that contains the external API. This is a string and usually the basename of a file.
|
||||||
* - "library": a string literal. This is required to make the query a valid problem query.
|
* - libraryVersion: the version of the library that contains the external API. This is a string and can be empty if the version cannot be determined.
|
||||||
* - type: the modeled kind of the method, either "sink", "source", "summary", or "neutral"
|
* - type: the modeled kind of the method, either "sink", "source", "summary", or "neutral"
|
||||||
* - "type": a string literal. This is required to make the query a valid problem query.
|
* - "type": a string literal. This is required to make the query a valid problem query.
|
||||||
* - classification: the classification of the use of the method, either "source", "test", "generated", or "unknown"
|
* - classification: the classification of the use of the method, either "source", "test", "generated", or "unknown"
|
||||||
@@ -25,7 +25,7 @@ export type Query = {
|
|||||||
* - supported: whether this method is modeled. This should be a string representation of a boolean to satify the result pattern for a problem query.
|
* - supported: whether this method is modeled. This should be a string representation of a boolean to satify the result pattern for a problem query.
|
||||||
* - "supported": a string literal. This is required to make the query a valid problem query.
|
* - "supported": a string literal. This is required to make the query a valid problem query.
|
||||||
* - libraryName: an arbitrary string. This is required to make it match the structure of the application query.
|
* - libraryName: an arbitrary string. This is required to make it match the structure of the application query.
|
||||||
* - "library": a string literal. This is required to make the query a valid problem query.
|
* - libraryVersion: an arbitrary string. This is required to make it match the structure of the application query.
|
||||||
* - type: the modeled kind of the method, either "sink", "source", "summary", or "neutral"
|
* - type: the modeled kind of the method, either "sink", "source", "summary", or "neutral"
|
||||||
* - "type": a string literal. This is required to make the query a valid problem query.
|
* - "type": a string literal. This is required to make the query a valid problem query.
|
||||||
* - "unknown": a string literal. This is required to make it match the structure of the application query.
|
* - "unknown": a string literal. This is required to make it match the structure of the application query.
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import Ajv from "ajv";
|
import Ajv from "ajv";
|
||||||
|
|
||||||
import { basename, extname } from "../common/path";
|
|
||||||
import { ExternalApiUsage } from "./external-api-usage";
|
import { ExternalApiUsage } from "./external-api-usage";
|
||||||
import { ModeledMethod, ModeledMethodType } from "./modeled-method";
|
import { ModeledMethod, ModeledMethodType } from "./modeled-method";
|
||||||
import {
|
import {
|
||||||
@@ -122,29 +121,12 @@ export function createDataExtensionYamlsForFrameworkMode(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// From the semver package using
|
|
||||||
// const { re, t } = require("semver/internal/re");
|
|
||||||
// console.log(re[t.LOOSE]);
|
|
||||||
// Modified to remove the ^ and $ anchors
|
|
||||||
// This will match any semver string at the end of a larger string
|
|
||||||
const semverRegex =
|
|
||||||
/[v=\s]*([0-9]+)\.([0-9]+)\.([0-9]+)(?:-?((?:[0-9]+|\d*[a-zA-Z-][a-zA-Z0-9-]*)(?:\.(?:[0-9]+|\d*[a-zA-Z-][a-zA-Z0-9-]*))*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?/;
|
|
||||||
|
|
||||||
export function createFilenameForLibrary(
|
export function createFilenameForLibrary(
|
||||||
library: string,
|
library: string,
|
||||||
prefix = "models/",
|
prefix = "models/",
|
||||||
suffix = ".model",
|
suffix = ".model",
|
||||||
) {
|
) {
|
||||||
let libraryName = basename(library);
|
let libraryName = library;
|
||||||
const extension = extname(libraryName);
|
|
||||||
libraryName = libraryName.slice(0, -extension.length);
|
|
||||||
|
|
||||||
const match = semverRegex.exec(libraryName);
|
|
||||||
|
|
||||||
if (match !== null) {
|
|
||||||
// Remove everything after the start of the match
|
|
||||||
libraryName = libraryName.slice(0, match.index);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Lowercase everything
|
// Lowercase everything
|
||||||
libraryName = libraryName.toLowerCase();
|
libraryName = libraryName.toLowerCase();
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ DataExtensionsEditor.args = {
|
|||||||
},
|
},
|
||||||
initialExternalApiUsages: [
|
initialExternalApiUsages: [
|
||||||
{
|
{
|
||||||
library: "sql2o-1.6.0.jar",
|
library: "sql2o",
|
||||||
|
libraryVersion: "1.6.0",
|
||||||
signature: "org.sql2o.Connection#createQuery(String)",
|
signature: "org.sql2o.Connection#createQuery(String)",
|
||||||
packageName: "org.sql2o",
|
packageName: "org.sql2o",
|
||||||
typeName: "Connection",
|
typeName: "Connection",
|
||||||
@@ -54,7 +55,8 @@ DataExtensionsEditor.args = {
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
library: "sql2o-1.6.0.jar",
|
library: "sql2o",
|
||||||
|
libraryVersion: "1.6.0",
|
||||||
signature: "org.sql2o.Query#executeScalar(Class)",
|
signature: "org.sql2o.Query#executeScalar(Class)",
|
||||||
packageName: "org.sql2o",
|
packageName: "org.sql2o",
|
||||||
typeName: "Query",
|
typeName: "Query",
|
||||||
@@ -75,7 +77,8 @@ DataExtensionsEditor.args = {
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
library: "sql2o-1.6.0.jar",
|
library: "sql2o",
|
||||||
|
libraryVersion: "1.6.0",
|
||||||
signature: "org.sql2o.Sql2o#open()",
|
signature: "org.sql2o.Sql2o#open()",
|
||||||
packageName: "org.sql2o",
|
packageName: "org.sql2o",
|
||||||
typeName: "Sql2o",
|
typeName: "Sql2o",
|
||||||
@@ -96,7 +99,7 @@ DataExtensionsEditor.args = {
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
library: "rt.jar",
|
library: "rt",
|
||||||
signature: "java.io.PrintStream#println(String)",
|
signature: "java.io.PrintStream#println(String)",
|
||||||
packageName: "java.io",
|
packageName: "java.io",
|
||||||
typeName: "PrintStream",
|
typeName: "PrintStream",
|
||||||
@@ -130,7 +133,8 @@ DataExtensionsEditor.args = {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
library: "spring-boot-3.0.2.jar",
|
library: "spring-boot",
|
||||||
|
libraryVersion: "3.0.2",
|
||||||
signature:
|
signature:
|
||||||
"org.springframework.boot.SpringApplication#run(Class,String[])",
|
"org.springframework.boot.SpringApplication#run(Class,String[])",
|
||||||
packageName: "org.springframework.boot",
|
packageName: "org.springframework.boot",
|
||||||
@@ -152,7 +156,8 @@ DataExtensionsEditor.args = {
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
library: "sql2o-1.6.0.jar",
|
library: "sql2o",
|
||||||
|
libraryVersion: "1.6.0",
|
||||||
signature: "org.sql2o.Sql2o#Sql2o(String,String,String)",
|
signature: "org.sql2o.Sql2o#Sql2o(String,String,String)",
|
||||||
packageName: "org.sql2o",
|
packageName: "org.sql2o",
|
||||||
typeName: "Sql2o",
|
typeName: "Sql2o",
|
||||||
@@ -173,7 +178,8 @@ DataExtensionsEditor.args = {
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
library: "sql2o-1.6.0.jar",
|
library: "sql2o",
|
||||||
|
libraryVersion: "1.6.0",
|
||||||
signature: "org.sql2o.Sql2o#Sql2o(String)",
|
signature: "org.sql2o.Sql2o#Sql2o(String)",
|
||||||
packageName: "org.sql2o",
|
packageName: "org.sql2o",
|
||||||
typeName: "Sql2o",
|
typeName: "Sql2o",
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ const ButtonsContainer = styled.div`
|
|||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
title: string;
|
title: string;
|
||||||
|
libraryVersion?: string;
|
||||||
externalApiUsages: ExternalApiUsage[];
|
externalApiUsages: ExternalApiUsage[];
|
||||||
modeledMethods: Record<string, ModeledMethod>;
|
modeledMethods: Record<string, ModeledMethod>;
|
||||||
viewState: DataExtensionEditorViewState;
|
viewState: DataExtensionEditorViewState;
|
||||||
@@ -91,6 +92,7 @@ type Props = {
|
|||||||
|
|
||||||
export const LibraryRow = ({
|
export const LibraryRow = ({
|
||||||
title,
|
title,
|
||||||
|
libraryVersion,
|
||||||
externalApiUsages,
|
externalApiUsages,
|
||||||
modeledMethods,
|
modeledMethods,
|
||||||
viewState,
|
viewState,
|
||||||
@@ -158,7 +160,10 @@ export const LibraryRow = ({
|
|||||||
<Codicon name="chevron-right" label="Expand" />
|
<Codicon name="chevron-right" label="Expand" />
|
||||||
)}
|
)}
|
||||||
<NameContainer>
|
<NameContainer>
|
||||||
<DependencyName>{title}</DependencyName>
|
<DependencyName>
|
||||||
|
{title}
|
||||||
|
{libraryVersion && <>@{libraryVersion}</>}
|
||||||
|
</DependencyName>
|
||||||
<ModeledPercentage>
|
<ModeledPercentage>
|
||||||
{percentFormatter.format(modeledPercentage / 100)} modeled
|
{percentFormatter.format(modeledPercentage / 100)} modeled
|
||||||
</ModeledPercentage>
|
</ModeledPercentage>
|
||||||
|
|||||||
@@ -271,8 +271,10 @@ function UnmodelableMethodRow(props: Props) {
|
|||||||
function ExternalApiUsageName(props: { externalApiUsage: ExternalApiUsage }) {
|
function ExternalApiUsageName(props: { externalApiUsage: ExternalApiUsage }) {
|
||||||
return (
|
return (
|
||||||
<span>
|
<span>
|
||||||
{props.externalApiUsage.packageName}.{props.externalApiUsage.typeName}.
|
{props.externalApiUsage.packageName && (
|
||||||
{props.externalApiUsage.methodName}
|
<>{props.externalApiUsage.packageName}.</>
|
||||||
|
)}
|
||||||
|
{props.externalApiUsage.typeName}.{props.externalApiUsage.methodName}
|
||||||
{props.externalApiUsage.methodParameters}
|
{props.externalApiUsage.methodParameters}
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { useMemo } from "react";
|
|||||||
import { ExternalApiUsage } from "../../data-extensions-editor/external-api-usage";
|
import { ExternalApiUsage } from "../../data-extensions-editor/external-api-usage";
|
||||||
import { ModeledMethod } from "../../data-extensions-editor/modeled-method";
|
import { ModeledMethod } from "../../data-extensions-editor/modeled-method";
|
||||||
import { LibraryRow } from "./LibraryRow";
|
import { LibraryRow } from "./LibraryRow";
|
||||||
|
import { Mode } from "../../data-extensions-editor/shared/mode";
|
||||||
import {
|
import {
|
||||||
groupMethods,
|
groupMethods,
|
||||||
sortGroupNames,
|
sortGroupNames,
|
||||||
@@ -31,6 +32,10 @@ type Props = {
|
|||||||
onGenerateFromSourceClick: () => void;
|
onGenerateFromSourceClick: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const libraryNameOverrides: Record<string, string> = {
|
||||||
|
rt: "Java Runtime",
|
||||||
|
};
|
||||||
|
|
||||||
export const ModeledMethodsList = ({
|
export const ModeledMethodsList = ({
|
||||||
externalApiUsages,
|
externalApiUsages,
|
||||||
unsavedModels,
|
unsavedModels,
|
||||||
@@ -46,6 +51,24 @@ export const ModeledMethodsList = ({
|
|||||||
[externalApiUsages, viewState.mode],
|
[externalApiUsages, viewState.mode],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const libraryVersions = useMemo(() => {
|
||||||
|
if (viewState.mode !== Mode.Application) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
const libraryVersions: Record<string, string> = {};
|
||||||
|
|
||||||
|
for (const externalApiUsage of externalApiUsages) {
|
||||||
|
const { library, libraryVersion } = externalApiUsage;
|
||||||
|
|
||||||
|
if (library && libraryVersion) {
|
||||||
|
libraryVersions[library] = libraryVersion;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return libraryVersions;
|
||||||
|
}, [externalApiUsages, viewState.mode]);
|
||||||
|
|
||||||
const sortedGroupNames = useMemo(() => sortGroupNames(grouped), [grouped]);
|
const sortedGroupNames = useMemo(() => sortGroupNames(grouped), [grouped]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -53,7 +76,8 @@ export const ModeledMethodsList = ({
|
|||||||
{sortedGroupNames.map((libraryName) => (
|
{sortedGroupNames.map((libraryName) => (
|
||||||
<LibraryRow
|
<LibraryRow
|
||||||
key={libraryName}
|
key={libraryName}
|
||||||
title={libraryName}
|
title={libraryNameOverrides[libraryName] ?? libraryName}
|
||||||
|
libraryVersion={libraryVersions[libraryName]}
|
||||||
externalApiUsages={grouped[libraryName]}
|
externalApiUsages={grouped[libraryName]}
|
||||||
hasUnsavedChanges={unsavedModels.has(libraryName)}
|
hasUnsavedChanges={unsavedModels.has(libraryName)}
|
||||||
modeledMethods={modeledMethods}
|
modeledMethods={modeledMethods}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { decodeBqrsToExternalApiUsages } from "../../../src/data-extensions-editor/bqrs";
|
import { decodeBqrsToExternalApiUsages } from "../../../src/data-extensions-editor/bqrs";
|
||||||
import { DecodedBqrsChunk } from "../../../src/common/bqrs-cli-types";
|
import { DecodedBqrsChunk } from "../../../src/common/bqrs-cli-types";
|
||||||
|
import { CallClassification } from "../../../src/data-extensions-editor/external-api-usage";
|
||||||
|
|
||||||
describe("decodeBqrsToExternalApiUsages", () => {
|
describe("decodeBqrsToExternalApiUsages", () => {
|
||||||
const chunk: DecodedBqrsChunk = {
|
const chunk: DecodedBqrsChunk = {
|
||||||
@@ -8,6 +9,12 @@ describe("decodeBqrsToExternalApiUsages", () => {
|
|||||||
{ name: "apiName", kind: "String" },
|
{ name: "apiName", kind: "String" },
|
||||||
{ kind: "String" },
|
{ kind: "String" },
|
||||||
{ kind: "String" },
|
{ kind: "String" },
|
||||||
|
{ kind: "String" },
|
||||||
|
{ kind: "String" },
|
||||||
|
{ name: "type", kind: "String" },
|
||||||
|
{ kind: "String" },
|
||||||
|
{ name: "classification", kind: "String" },
|
||||||
|
{ kind: "String" },
|
||||||
],
|
],
|
||||||
tuples: [
|
tuples: [
|
||||||
[
|
[
|
||||||
@@ -24,6 +31,12 @@ describe("decodeBqrsToExternalApiUsages", () => {
|
|||||||
"java.io.PrintStream#println(String)",
|
"java.io.PrintStream#println(String)",
|
||||||
"true",
|
"true",
|
||||||
"supported",
|
"supported",
|
||||||
|
"rt.jar",
|
||||||
|
"",
|
||||||
|
"sink",
|
||||||
|
"type",
|
||||||
|
"source",
|
||||||
|
"classification",
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
@@ -39,6 +52,12 @@ describe("decodeBqrsToExternalApiUsages", () => {
|
|||||||
"org.springframework.boot.SpringApplication#run(Class,String[])",
|
"org.springframework.boot.SpringApplication#run(Class,String[])",
|
||||||
"false",
|
"false",
|
||||||
"supported",
|
"supported",
|
||||||
|
"spring-boot-3.0.2.jar",
|
||||||
|
"",
|
||||||
|
"none",
|
||||||
|
"type",
|
||||||
|
"source",
|
||||||
|
"classification",
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
@@ -54,6 +73,12 @@ describe("decodeBqrsToExternalApiUsages", () => {
|
|||||||
"org.sql2o.Connection#createQuery(String)",
|
"org.sql2o.Connection#createQuery(String)",
|
||||||
"true",
|
"true",
|
||||||
"supported",
|
"supported",
|
||||||
|
"sql2o-1.6.0.jar",
|
||||||
|
"",
|
||||||
|
"sink",
|
||||||
|
"type",
|
||||||
|
"source",
|
||||||
|
"classification",
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
@@ -69,6 +94,12 @@ describe("decodeBqrsToExternalApiUsages", () => {
|
|||||||
"org.sql2o.Connection#createQuery(String)",
|
"org.sql2o.Connection#createQuery(String)",
|
||||||
"true",
|
"true",
|
||||||
"supported",
|
"supported",
|
||||||
|
"sql2o-1.6.0.jar",
|
||||||
|
"",
|
||||||
|
"sink",
|
||||||
|
"type",
|
||||||
|
"source",
|
||||||
|
"classification",
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
@@ -84,6 +115,12 @@ describe("decodeBqrsToExternalApiUsages", () => {
|
|||||||
"org.sql2o.Query#executeScalar(Class)",
|
"org.sql2o.Query#executeScalar(Class)",
|
||||||
"true",
|
"true",
|
||||||
"supported",
|
"supported",
|
||||||
|
"sql2o-1.6.0.jar",
|
||||||
|
"",
|
||||||
|
"sink",
|
||||||
|
"type",
|
||||||
|
"source",
|
||||||
|
"classification",
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
@@ -99,6 +136,12 @@ describe("decodeBqrsToExternalApiUsages", () => {
|
|||||||
"org.sql2o.Query#executeScalar(Class)",
|
"org.sql2o.Query#executeScalar(Class)",
|
||||||
"true",
|
"true",
|
||||||
"supported",
|
"supported",
|
||||||
|
"sql2o-1.6.0.jar",
|
||||||
|
"",
|
||||||
|
"sink",
|
||||||
|
"type",
|
||||||
|
"source",
|
||||||
|
"classification",
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
@@ -114,6 +157,12 @@ describe("decodeBqrsToExternalApiUsages", () => {
|
|||||||
"org.sql2o.Sql2o#open()",
|
"org.sql2o.Sql2o#open()",
|
||||||
"true",
|
"true",
|
||||||
"supported",
|
"supported",
|
||||||
|
"sql2o-1.6.0.jar",
|
||||||
|
"",
|
||||||
|
"sink",
|
||||||
|
"type",
|
||||||
|
"source",
|
||||||
|
"classification",
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
@@ -129,6 +178,12 @@ describe("decodeBqrsToExternalApiUsages", () => {
|
|||||||
"org.sql2o.Sql2o#open()",
|
"org.sql2o.Sql2o#open()",
|
||||||
"true",
|
"true",
|
||||||
"supported",
|
"supported",
|
||||||
|
"sql2o-1.6.0.jar",
|
||||||
|
"",
|
||||||
|
"sink",
|
||||||
|
"type",
|
||||||
|
"source",
|
||||||
|
"classification",
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
@@ -144,6 +199,12 @@ describe("decodeBqrsToExternalApiUsages", () => {
|
|||||||
"org.sql2o.Sql2o#Sql2o(String,String,String)",
|
"org.sql2o.Sql2o#Sql2o(String,String,String)",
|
||||||
"true",
|
"true",
|
||||||
"supported",
|
"supported",
|
||||||
|
"sql2o-1.6.0.jar",
|
||||||
|
"",
|
||||||
|
"sink",
|
||||||
|
"type",
|
||||||
|
"source",
|
||||||
|
"classification",
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
@@ -159,6 +220,12 @@ describe("decodeBqrsToExternalApiUsages", () => {
|
|||||||
"org.sql2o.Sql2o#Sql2o(String)",
|
"org.sql2o.Sql2o#Sql2o(String)",
|
||||||
"true",
|
"true",
|
||||||
"supported",
|
"supported",
|
||||||
|
"sql2o-1.6.0.jar",
|
||||||
|
"",
|
||||||
|
"sink",
|
||||||
|
"type",
|
||||||
|
"source",
|
||||||
|
"classification",
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
@@ -169,12 +236,15 @@ describe("decodeBqrsToExternalApiUsages", () => {
|
|||||||
// - Sorting the array of usages is guaranteed to be a stable sort
|
// - Sorting the array of usages is guaranteed to be a stable sort
|
||||||
expect(decodeBqrsToExternalApiUsages(chunk)).toEqual([
|
expect(decodeBqrsToExternalApiUsages(chunk)).toEqual([
|
||||||
{
|
{
|
||||||
|
library: "rt",
|
||||||
|
libraryVersion: undefined,
|
||||||
signature: "java.io.PrintStream#println(String)",
|
signature: "java.io.PrintStream#println(String)",
|
||||||
packageName: "java.io",
|
packageName: "java.io",
|
||||||
typeName: "PrintStream",
|
typeName: "PrintStream",
|
||||||
methodName: "println",
|
methodName: "println",
|
||||||
methodParameters: "(String)",
|
methodParameters: "(String)",
|
||||||
supported: true,
|
supported: true,
|
||||||
|
supportedType: "sink",
|
||||||
usages: [
|
usages: [
|
||||||
{
|
{
|
||||||
label: "println(...)",
|
label: "println(...)",
|
||||||
@@ -185,10 +255,13 @@ describe("decodeBqrsToExternalApiUsages", () => {
|
|||||||
endLine: 29,
|
endLine: 29,
|
||||||
endColumn: 49,
|
endColumn: 49,
|
||||||
},
|
},
|
||||||
|
classification: CallClassification.Source,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
library: "spring-boot",
|
||||||
|
libraryVersion: "3.0.2",
|
||||||
signature:
|
signature:
|
||||||
"org.springframework.boot.SpringApplication#run(Class,String[])",
|
"org.springframework.boot.SpringApplication#run(Class,String[])",
|
||||||
packageName: "org.springframework.boot",
|
packageName: "org.springframework.boot",
|
||||||
@@ -196,6 +269,7 @@ describe("decodeBqrsToExternalApiUsages", () => {
|
|||||||
methodName: "run",
|
methodName: "run",
|
||||||
methodParameters: "(Class,String[])",
|
methodParameters: "(Class,String[])",
|
||||||
supported: false,
|
supported: false,
|
||||||
|
supportedType: "none",
|
||||||
usages: [
|
usages: [
|
||||||
{
|
{
|
||||||
label: "run(...)",
|
label: "run(...)",
|
||||||
@@ -206,16 +280,20 @@ describe("decodeBqrsToExternalApiUsages", () => {
|
|||||||
endLine: 9,
|
endLine: 9,
|
||||||
endColumn: 66,
|
endColumn: 66,
|
||||||
},
|
},
|
||||||
|
classification: CallClassification.Source,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
library: "sql2o",
|
||||||
|
libraryVersion: "1.6.0",
|
||||||
signature: "org.sql2o.Connection#createQuery(String)",
|
signature: "org.sql2o.Connection#createQuery(String)",
|
||||||
packageName: "org.sql2o",
|
packageName: "org.sql2o",
|
||||||
typeName: "Connection",
|
typeName: "Connection",
|
||||||
methodName: "createQuery",
|
methodName: "createQuery",
|
||||||
methodParameters: "(String)",
|
methodParameters: "(String)",
|
||||||
supported: true,
|
supported: true,
|
||||||
|
supportedType: "sink",
|
||||||
usages: [
|
usages: [
|
||||||
{
|
{
|
||||||
label: "createQuery(...)",
|
label: "createQuery(...)",
|
||||||
@@ -226,6 +304,7 @@ describe("decodeBqrsToExternalApiUsages", () => {
|
|||||||
endLine: 15,
|
endLine: 15,
|
||||||
endColumn: 56,
|
endColumn: 56,
|
||||||
},
|
},
|
||||||
|
classification: CallClassification.Source,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "createQuery(...)",
|
label: "createQuery(...)",
|
||||||
@@ -236,16 +315,20 @@ describe("decodeBqrsToExternalApiUsages", () => {
|
|||||||
endLine: 26,
|
endLine: 26,
|
||||||
endColumn: 39,
|
endColumn: 39,
|
||||||
},
|
},
|
||||||
|
classification: CallClassification.Source,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
library: "sql2o",
|
||||||
|
libraryVersion: "1.6.0",
|
||||||
signature: "org.sql2o.Query#executeScalar(Class)",
|
signature: "org.sql2o.Query#executeScalar(Class)",
|
||||||
packageName: "org.sql2o",
|
packageName: "org.sql2o",
|
||||||
typeName: "Query",
|
typeName: "Query",
|
||||||
methodName: "executeScalar",
|
methodName: "executeScalar",
|
||||||
methodParameters: "(Class)",
|
methodParameters: "(Class)",
|
||||||
supported: true,
|
supported: true,
|
||||||
|
supportedType: "sink",
|
||||||
usages: [
|
usages: [
|
||||||
{
|
{
|
||||||
label: "executeScalar(...)",
|
label: "executeScalar(...)",
|
||||||
@@ -256,6 +339,7 @@ describe("decodeBqrsToExternalApiUsages", () => {
|
|||||||
endLine: 15,
|
endLine: 15,
|
||||||
endColumn: 85,
|
endColumn: 85,
|
||||||
},
|
},
|
||||||
|
classification: CallClassification.Source,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "executeScalar(...)",
|
label: "executeScalar(...)",
|
||||||
@@ -266,16 +350,20 @@ describe("decodeBqrsToExternalApiUsages", () => {
|
|||||||
endLine: 26,
|
endLine: 26,
|
||||||
endColumn: 68,
|
endColumn: 68,
|
||||||
},
|
},
|
||||||
|
classification: CallClassification.Source,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
library: "sql2o",
|
||||||
|
libraryVersion: "1.6.0",
|
||||||
signature: "org.sql2o.Sql2o#open()",
|
signature: "org.sql2o.Sql2o#open()",
|
||||||
packageName: "org.sql2o",
|
packageName: "org.sql2o",
|
||||||
typeName: "Sql2o",
|
typeName: "Sql2o",
|
||||||
methodName: "open",
|
methodName: "open",
|
||||||
methodParameters: "()",
|
methodParameters: "()",
|
||||||
supported: true,
|
supported: true,
|
||||||
|
supportedType: "sink",
|
||||||
usages: [
|
usages: [
|
||||||
{
|
{
|
||||||
label: "open(...)",
|
label: "open(...)",
|
||||||
@@ -286,6 +374,7 @@ describe("decodeBqrsToExternalApiUsages", () => {
|
|||||||
endLine: 14,
|
endLine: 14,
|
||||||
endColumn: 35,
|
endColumn: 35,
|
||||||
},
|
},
|
||||||
|
classification: CallClassification.Source,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "open(...)",
|
label: "open(...)",
|
||||||
@@ -296,16 +385,20 @@ describe("decodeBqrsToExternalApiUsages", () => {
|
|||||||
endLine: 25,
|
endLine: 25,
|
||||||
endColumn: 35,
|
endColumn: 35,
|
||||||
},
|
},
|
||||||
|
classification: CallClassification.Source,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
library: "sql2o",
|
||||||
|
libraryVersion: "1.6.0",
|
||||||
signature: "org.sql2o.Sql2o#Sql2o(String,String,String)",
|
signature: "org.sql2o.Sql2o#Sql2o(String,String,String)",
|
||||||
packageName: "org.sql2o",
|
packageName: "org.sql2o",
|
||||||
typeName: "Sql2o",
|
typeName: "Sql2o",
|
||||||
methodName: "Sql2o",
|
methodName: "Sql2o",
|
||||||
methodParameters: "(String,String,String)",
|
methodParameters: "(String,String,String)",
|
||||||
supported: true,
|
supported: true,
|
||||||
|
supportedType: "sink",
|
||||||
usages: [
|
usages: [
|
||||||
{
|
{
|
||||||
label: "new Sql2o(...)",
|
label: "new Sql2o(...)",
|
||||||
@@ -316,16 +409,20 @@ describe("decodeBqrsToExternalApiUsages", () => {
|
|||||||
endLine: 10,
|
endLine: 10,
|
||||||
endColumn: 88,
|
endColumn: 88,
|
||||||
},
|
},
|
||||||
|
classification: CallClassification.Source,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
library: "sql2o",
|
||||||
|
libraryVersion: "1.6.0",
|
||||||
signature: "org.sql2o.Sql2o#Sql2o(String)",
|
signature: "org.sql2o.Sql2o#Sql2o(String)",
|
||||||
packageName: "org.sql2o",
|
packageName: "org.sql2o",
|
||||||
typeName: "Sql2o",
|
typeName: "Sql2o",
|
||||||
methodName: "Sql2o",
|
methodName: "Sql2o",
|
||||||
methodParameters: "(String)",
|
methodParameters: "(String)",
|
||||||
supported: true,
|
supported: true,
|
||||||
|
supportedType: "sink",
|
||||||
usages: [
|
usages: [
|
||||||
{
|
{
|
||||||
label: "new Sql2o(...)",
|
label: "new Sql2o(...)",
|
||||||
@@ -336,6 +433,7 @@ describe("decodeBqrsToExternalApiUsages", () => {
|
|||||||
endLine: 23,
|
endLine: 23,
|
||||||
endColumn: 36,
|
endColumn: 36,
|
||||||
},
|
},
|
||||||
|
classification: CallClassification.Source,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1,99 @@
|
|||||||
|
import { parseLibraryFilename } from "../../../src/data-extensions-editor/library";
|
||||||
|
|
||||||
|
describe("parseLibraryFilename", () => {
|
||||||
|
const testCases = [
|
||||||
|
{ filename: "sql2o-1.6.0.jar", name: "sql2o", version: "1.6.0" },
|
||||||
|
{
|
||||||
|
filename: "spring-boot-3.0.2.jar",
|
||||||
|
name: "spring-boot",
|
||||||
|
version: "3.0.2",
|
||||||
|
},
|
||||||
|
{ filename: "rt.jar", name: "rt", version: undefined },
|
||||||
|
{ filename: "guava-15.0.jar", name: "guava", version: "15.0" },
|
||||||
|
{
|
||||||
|
filename: "embedded-db-junit-1.0.0.jar",
|
||||||
|
name: "embedded-db-junit",
|
||||||
|
version: "1.0.0",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
filename: "h2-1.3.160.jar",
|
||||||
|
name: "h2",
|
||||||
|
version: "1.3.160",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
filename: "joda-time-2.0.jar",
|
||||||
|
name: "joda-time",
|
||||||
|
version: "2.0",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
filename: "System.Runtime.dll",
|
||||||
|
name: "System.Runtime",
|
||||||
|
version: undefined,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
filename: "System.Linq.Expressions.dll",
|
||||||
|
name: "System.Linq.Expressions",
|
||||||
|
version: undefined,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
filename: "System.Diagnostics.Debug.dll",
|
||||||
|
name: "System.Diagnostics.Debug",
|
||||||
|
version: undefined,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
filename: "spring-boot-3.1.0-rc2.jar",
|
||||||
|
name: "spring-boot",
|
||||||
|
version: "3.1.0-rc2",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
filename: "org.eclipse.sisu.plexus-0.9.0.M2.jar",
|
||||||
|
name: "org.eclipse.sisu.plexus",
|
||||||
|
version: "0.9.0.M2",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
filename: "org.eclipse.sisu.inject-0.9.0.M2.jar",
|
||||||
|
name: "org.eclipse.sisu.inject",
|
||||||
|
version: "0.9.0.M2",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
filename: "slf4j-api-1.7.36.jar",
|
||||||
|
name: "slf4j-api",
|
||||||
|
version: "1.7.36",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
filename: "guava-30.1.1-jre.jar",
|
||||||
|
name: "guava",
|
||||||
|
version: "30.1.1-jre",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
filename: "caliper-1.0-beta-3.jar",
|
||||||
|
name: "caliper",
|
||||||
|
version: "1.0-beta-3",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
filename: "protobuf-java-4.0.0-rc-2.jar",
|
||||||
|
name: "protobuf-java",
|
||||||
|
version: "4.0.0-rc-2",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
filename: "jetty-util-9.4.51.v20230217.jar",
|
||||||
|
name: "jetty-util",
|
||||||
|
version: "9.4.51.v20230217",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
filename: "jetty-servlet-9.4.51.v20230217.jar",
|
||||||
|
name: "jetty-servlet",
|
||||||
|
version: "9.4.51.v20230217",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
test.each(testCases)(
|
||||||
|
"$filename is $name@$version",
|
||||||
|
({ filename, name, version }) => {
|
||||||
|
expect(parseLibraryFilename(filename)).toEqual({
|
||||||
|
name,
|
||||||
|
version,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
@@ -81,7 +81,8 @@ describe("createDataExtensionYamlsForApplicationMode", () => {
|
|||||||
"java",
|
"java",
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
library: "sql2o-1.6.0.jar",
|
library: "sql2o",
|
||||||
|
libraryVersion: "1.6.0",
|
||||||
signature: "org.sql2o.Connection#createQuery(String)",
|
signature: "org.sql2o.Connection#createQuery(String)",
|
||||||
packageName: "org.sql2o",
|
packageName: "org.sql2o",
|
||||||
typeName: "Connection",
|
typeName: "Connection",
|
||||||
@@ -115,7 +116,8 @@ describe("createDataExtensionYamlsForApplicationMode", () => {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
library: "sql2o-1.6.0.jar",
|
library: "sql2o",
|
||||||
|
libraryVersion: "1.6.0",
|
||||||
signature: "org.sql2o.Query#executeScalar(Class)",
|
signature: "org.sql2o.Query#executeScalar(Class)",
|
||||||
packageName: "org.sql2o",
|
packageName: "org.sql2o",
|
||||||
typeName: "Query",
|
typeName: "Query",
|
||||||
@@ -149,7 +151,8 @@ describe("createDataExtensionYamlsForApplicationMode", () => {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
library: "sql2o-2.5.0-alpha1.jar",
|
library: "sql2o",
|
||||||
|
libraryVersion: "2.5.0-alpha1",
|
||||||
signature: "org.sql2o.Sql2o#Sql2o(String,String,String)",
|
signature: "org.sql2o.Sql2o#Sql2o(String,String,String)",
|
||||||
packageName: "org.sql2o",
|
packageName: "org.sql2o",
|
||||||
typeName: "Sql2o",
|
typeName: "Sql2o",
|
||||||
@@ -172,7 +175,8 @@ describe("createDataExtensionYamlsForApplicationMode", () => {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
library: "spring-boot-3.0.2.jar",
|
library: "spring-boot",
|
||||||
|
libraryVersion: "3.0.2",
|
||||||
signature:
|
signature:
|
||||||
"org.springframework.boot.SpringApplication#run(Class,String[])",
|
"org.springframework.boot.SpringApplication#run(Class,String[])",
|
||||||
packageName: "org.springframework.boot",
|
packageName: "org.springframework.boot",
|
||||||
@@ -196,7 +200,7 @@ describe("createDataExtensionYamlsForApplicationMode", () => {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
library: "rt.jar",
|
library: "rt",
|
||||||
signature: "java.io.PrintStream#println(String)",
|
signature: "java.io.PrintStream#println(String)",
|
||||||
packageName: "java.io",
|
packageName: "java.io",
|
||||||
typeName: "PrintStream",
|
typeName: "PrintStream",
|
||||||
@@ -530,37 +534,28 @@ describe("loadDataExtensionYaml", () => {
|
|||||||
|
|
||||||
describe("createFilenameForLibrary", () => {
|
describe("createFilenameForLibrary", () => {
|
||||||
const testCases = [
|
const testCases = [
|
||||||
{ library: "sql2o.jar", filename: "models/sql2o.model.yml" },
|
|
||||||
{
|
{
|
||||||
library: "sql2o-1.6.0.jar",
|
library: "sql2o",
|
||||||
filename: "models/sql2o.model.yml",
|
filename: "models/sql2o.model.yml",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
library: "spring-boot-3.0.2.jar",
|
library: "spring-boot",
|
||||||
filename: "models/spring-boot.model.yml",
|
filename: "models/spring-boot.model.yml",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
library: "spring-boot-v3.0.2.jar",
|
library: "spring--boot",
|
||||||
filename: "models/spring-boot.model.yml",
|
filename: "models/spring-boot.model.yml",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
library: "spring-boot-3.0.2-alpha1.jar",
|
library: "rt",
|
||||||
filename: "models/spring-boot.model.yml",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
library: "spring-boot-3.0.2beta2.jar",
|
|
||||||
filename: "models/spring-boot.model.yml",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
library: "rt.jar",
|
|
||||||
filename: "models/rt.model.yml",
|
filename: "models/rt.model.yml",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
library: "System.Runtime.dll",
|
library: "System.Runtime",
|
||||||
filename: "models/system.runtime.model.yml",
|
filename: "models/system.runtime.model.yml",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
library: "System.Runtime.1.5.0.dll",
|
library: "System..Runtime",
|
||||||
filename: "models/system.runtime.model.yml",
|
filename: "models/system.runtime.model.yml",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user