diff --git a/src/provider/Provider.ts b/src/aquarius/Aquarius.ts similarity index 96% rename from src/provider/Provider.ts rename to src/aquarius/Aquarius.ts index ca86b9b..8503c80 100644 --- a/src/provider/Provider.ts +++ b/src/aquarius/Aquarius.ts @@ -1,7 +1,7 @@ import fetch from "node-fetch" import Logger from "../utils/Logger" -export default class Provider { +export default class Aquarius { public static async getAccessUrl(accessToken: any, payload: any): Promise { const accessUrl = await fetch(`${accessToken.service_endpoint}/${accessToken.resource_id}`, { diff --git a/src/aquarius/AquariusProvider.ts b/src/aquarius/AquariusProvider.ts new file mode 100644 index 0000000..ab5db68 --- /dev/null +++ b/src/aquarius/AquariusProvider.ts @@ -0,0 +1,14 @@ +export default class AquariusProvider { + + public static setAquarius(aquarius) { + + AquariusProvider.aquarius = aquarius + } + + public static getAquarius() { + + return AquariusProvider.aquarius + } + + private static aquarius +} diff --git a/src/ocean/Ocean.ts b/src/ocean/Ocean.ts index 8798d8e..c390253 100644 --- a/src/ocean/Ocean.ts +++ b/src/ocean/Ocean.ts @@ -1,8 +1,8 @@ +import Aquarius from "../aquarius/Aquarius" +import AquariusProvider from "../aquarius/AquariusProvider" import ConfigProvider from "../ConfigProvider" import Keeper from "../keeper/Keeper" import Web3Provider from "../keeper/Web3Provider" -import Provider from "../provider/Provider" -import ProviderProvider from "../provider/ProviderProvider" import Logger from "../utils/Logger" import Account from "./Account" import Asset from "./Asset" @@ -14,7 +14,7 @@ export default class Ocean { if (!Ocean.instance) { ConfigProvider.configure(config) - ProviderProvider.setProvider(Provider) + AquariusProvider.setAquarius(Aquarius) Ocean.instance = new Ocean(await Keeper.getInstance()) } diff --git a/src/ocean/Order.ts b/src/ocean/Order.ts index fbac0c0..1e061cb 100644 --- a/src/ocean/Order.ts +++ b/src/ocean/Order.ts @@ -1,9 +1,9 @@ import * as EthEcies from "eth-ecies" import * as JWT from "jsonwebtoken" +import AquariusProvider from "../aquarius/AquariusProvider" import Keeper from "../keeper/Keeper" import Web3Provider from "../keeper/Web3Provider" import AccessStatus from "../models/AccessStatus" -import ProviderProvider from "../provider/ProviderProvider" import Logger from "../utils/Logger" import Account from "./Account" import Asset from "./Asset" @@ -87,7 +87,7 @@ export default class Order extends OceanBase { jwt: accessTokenEncoded, }) - const accessUrl = await ProviderProvider.getProvider().getAccessUrl(accessToken, payload) + const accessUrl = await AquariusProvider.getAquarius().getAccessUrl(accessToken, payload) Logger.log("consume url: ", accessUrl) diff --git a/src/provider/ProviderProvider.ts b/src/provider/ProviderProvider.ts deleted file mode 100644 index 55e45c5..0000000 --- a/src/provider/ProviderProvider.ts +++ /dev/null @@ -1,14 +0,0 @@ -export default class ProviderProvider { - - public static setProvider(provider) { - - ProviderProvider.provider = provider - } - - public static getProvider() { - - return ProviderProvider.provider - } - - private static provider -} diff --git a/test/mocks/Provider.Mock.ts b/test/mocks/Aquarius.mock.ts similarity index 55% rename from test/mocks/Provider.Mock.ts rename to test/mocks/Aquarius.mock.ts index 0794be5..46d479e 100644 --- a/test/mocks/Provider.Mock.ts +++ b/test/mocks/Aquarius.mock.ts @@ -1,6 +1,6 @@ -import Provider from "../../src/provider/Provider" +import Aquarius from "../../src/aquarius/Aquarius" -export default class ProviderMock extends Provider { +export default class AquariusMock extends Aquarius { public static async getAccessUrl(accessToken: any, payload: any): Promise { return "http://test/test" diff --git a/test/ocean/Asset.test.ts b/test/ocean/Asset.test.ts index 4f9d96c..4a2c17f 100644 --- a/test/ocean/Asset.test.ts +++ b/test/ocean/Asset.test.ts @@ -1,13 +1,13 @@ import {assert} from "chai" +import AquariusProvider from "../../src/aquarius/AquariusProvider" import ConfigProvider from "../../src/ConfigProvider" import ContractHandler from "../../src/keeper/ContractHandler" import Account from "../../src/ocean/Account" import Asset from "../../src/ocean/Asset" import Ocean from "../../src/ocean/Ocean" import Order from "../../src/ocean/Order" -import ProviderProvider from "../../src/provider/ProviderProvider" import config from "../config" -import ProviderMock from "../mocks/Provider.Mock" +import AquariusMock from "../mocks/Aquarius.mock" const testName = "Test Asset 2" const testDescription = "This asset is pure owange" @@ -21,7 +21,7 @@ let testPublisher: Account before(async () => { ConfigProvider.configure(config) - ProviderProvider.setProvider(ProviderMock) + AquariusProvider.setAquarius(AquariusMock) await ContractHandler.deployContracts() ocean = await Ocean.getInstance(config)