mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
fix: Resolve merge conflicts caused by move to guardedStream
This commit is contained in:
parent
f4afc3ce16
commit
cdf7e77e6b
10
index.ts
10
index.ts
@ -121,16 +121,12 @@ export * from './src/storage/AtomicResourceStore';
|
|||||||
export * from './src/storage/Conditions';
|
export * from './src/storage/Conditions';
|
||||||
export * from './src/storage/DataAccessorBasedStore';
|
export * from './src/storage/DataAccessorBasedStore';
|
||||||
export * from './src/storage/FileIdentifierMapper';
|
export * from './src/storage/FileIdentifierMapper';
|
||||||
export * from './src/storage/Lock';
|
|
||||||
export * from './src/storage/LockingResourceStore';
|
export * from './src/storage/LockingResourceStore';
|
||||||
export * from './src/storage/PassthroughStore';
|
export * from './src/storage/PassthroughStore';
|
||||||
export * from './src/storage/PatchingStore';
|
export * from './src/storage/PatchingStore';
|
||||||
export * from './src/storage/RepresentationConvertingStore';
|
export * from './src/storage/RepresentationConvertingStore';
|
||||||
export * from './src/storage/ResourceLocker';
|
|
||||||
export * from './src/storage/ResourceStore';
|
export * from './src/storage/ResourceStore';
|
||||||
export * from './src/storage/RoutingResourceStore';
|
export * from './src/storage/RoutingResourceStore';
|
||||||
export * from './src/storage/SingleThreadedResourceLocker';
|
|
||||||
export * from './src/storage/WrappedExpiringResourceLocker';
|
|
||||||
|
|
||||||
// Util/Errors
|
// Util/Errors
|
||||||
export * from './src/util/errors/ConflictHttpError';
|
export * from './src/util/errors/ConflictHttpError';
|
||||||
@ -143,6 +139,12 @@ export * from './src/util/errors/UnauthorizedHttpError';
|
|||||||
export * from './src/util/errors/UnsupportedHttpError';
|
export * from './src/util/errors/UnsupportedHttpError';
|
||||||
export * from './src/util/errors/UnsupportedMediaTypeHttpError';
|
export * from './src/util/errors/UnsupportedMediaTypeHttpError';
|
||||||
|
|
||||||
|
// Util/Locking
|
||||||
|
export * from './src/util/locking/Lock';
|
||||||
|
export * from './src/util/locking/ResourceLocker';
|
||||||
|
export * from './src/util/locking/SingleThreadedResourceLocker';
|
||||||
|
export * from './src/util/locking/WrappedExpiringResourceLocker';
|
||||||
|
|
||||||
// Util
|
// Util
|
||||||
export * from './src/util/AllVoidCompositeHandler';
|
export * from './src/util/AllVoidCompositeHandler';
|
||||||
export * from './src/util/AsyncHandler';
|
export * from './src/util/AsyncHandler';
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
import streamifyArray from 'streamify-array';
|
import streamifyArray from 'streamify-array';
|
||||||
|
import type { Representation } from '../../src/ldp/representation/Representation';
|
||||||
import { RepresentationMetadata } from '../../src/ldp/representation/RepresentationMetadata';
|
import { RepresentationMetadata } from '../../src/ldp/representation/RepresentationMetadata';
|
||||||
import { InMemoryDataAccessor } from '../../src/storage/accessors/InMemoryDataAccessor';
|
import { InMemoryDataAccessor } from '../../src/storage/accessors/InMemoryDataAccessor';
|
||||||
import { DataAccessorBasedStore } from '../../src/storage/DataAccessorBasedStore';
|
import { DataAccessorBasedStore } from '../../src/storage/DataAccessorBasedStore';
|
||||||
import { LockingResourceStore } from '../../src/storage/LockingResourceStore';
|
import { LockingResourceStore } from '../../src/storage/LockingResourceStore';
|
||||||
import type { ResourceStore } from '../../src/storage/ResourceStore';
|
import type { ResourceStore } from '../../src/storage/ResourceStore';
|
||||||
import { UrlContainerManager } from '../../src/storage/UrlContainerManager';
|
|
||||||
import { APPLICATION_OCTET_STREAM } from '../../src/util/ContentTypes';
|
import { APPLICATION_OCTET_STREAM } from '../../src/util/ContentTypes';
|
||||||
import type { ExpiringResourceLocker } from '../../src/util/locking/ExpiringResourceLocker';
|
import type { ExpiringResourceLocker } from '../../src/util/locking/ExpiringResourceLocker';
|
||||||
import type { ResourceLocker } from '../../src/util/locking/ResourceLocker';
|
import type { ResourceLocker } from '../../src/util/locking/ResourceLocker';
|
||||||
import { SingleThreadedResourceLocker } from '../../src/util/locking/SingleThreadedResourceLocker';
|
import { SingleThreadedResourceLocker } from '../../src/util/locking/SingleThreadedResourceLocker';
|
||||||
import { WrappedExpiringResourceLocker } from '../../src/util/locking/WrappedExpiringResourceLocker';
|
import { WrappedExpiringResourceLocker } from '../../src/util/locking/WrappedExpiringResourceLocker';
|
||||||
import { MetadataController } from '../../src/util/MetadataController';
|
import { guardedStreamFrom } from '../../src/util/StreamUtil';
|
||||||
import { CONTENT_TYPE } from '../../src/util/UriConstants';
|
import { CONTENT_TYPE } from '../../src/util/UriConstants';
|
||||||
|
|
||||||
describe('A LockingResourceStore', (): void => {
|
describe('A LockingResourceStore', (): void => {
|
||||||
@ -25,11 +25,7 @@ describe('A LockingResourceStore', (): void => {
|
|||||||
|
|
||||||
const base = 'http://test.com/';
|
const base = 'http://test.com/';
|
||||||
path = `${base}path`;
|
path = `${base}path`;
|
||||||
const metadataController = new MetadataController();
|
source = new DataAccessorBasedStore(new InMemoryDataAccessor(base), base);
|
||||||
const containerManager = new UrlContainerManager(base);
|
|
||||||
source = new DataAccessorBasedStore(
|
|
||||||
new InMemoryDataAccessor(base, metadataController), base, metadataController, containerManager,
|
|
||||||
);
|
|
||||||
|
|
||||||
locker = new SingleThreadedResourceLocker();
|
locker = new SingleThreadedResourceLocker();
|
||||||
expiringLocker = new WrappedExpiringResourceLocker(locker, 1000);
|
expiringLocker = new WrappedExpiringResourceLocker(locker, 1000);
|
||||||
@ -38,7 +34,7 @@ describe('A LockingResourceStore', (): void => {
|
|||||||
|
|
||||||
// Make sure something is in the store before we read from it in our tests.
|
// Make sure something is in the store before we read from it in our tests.
|
||||||
const metadata = new RepresentationMetadata({ [CONTENT_TYPE]: APPLICATION_OCTET_STREAM });
|
const metadata = new RepresentationMetadata({ [CONTENT_TYPE]: APPLICATION_OCTET_STREAM });
|
||||||
const data = streamifyArray([ 1, 2, 3 ]);
|
const data = guardedStreamFrom([ 1, 2, 3 ]);
|
||||||
await store.setRepresentation({ path }, { metadata, data, binary: true });
|
await store.setRepresentation({ path }, { metadata, data, binary: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -48,6 +44,8 @@ describe('A LockingResourceStore', (): void => {
|
|||||||
// Spy on a real ResourceLocker and ResourceStore instance
|
// Spy on a real ResourceLocker and ResourceStore instance
|
||||||
const acquireSpy = jest.spyOn(expiringLocker, 'acquire');
|
const acquireSpy = jest.spyOn(expiringLocker, 'acquire');
|
||||||
const getRepresentationSpy = jest.spyOn(source, 'getRepresentation');
|
const getRepresentationSpy = jest.spyOn(source, 'getRepresentation');
|
||||||
|
getRepresentationSpy.mockReturnValue(new Promise((resolve): any => resolve({ data:
|
||||||
|
streamifyArray([ 1, 2, 3 ]) } as Representation)));
|
||||||
|
|
||||||
const representation = await store.getRepresentation({ path }, {});
|
const representation = await store.getRepresentation({ path }, {});
|
||||||
const errorCallback = jest.fn();
|
const errorCallback = jest.fn();
|
||||||
@ -74,6 +72,8 @@ describe('A LockingResourceStore', (): void => {
|
|||||||
// Spy on a real ResourceLocker and ResourceStore instance
|
// Spy on a real ResourceLocker and ResourceStore instance
|
||||||
const acquireSpy = jest.spyOn(expiringLocker, 'acquire');
|
const acquireSpy = jest.spyOn(expiringLocker, 'acquire');
|
||||||
const getRepresentationSpy = jest.spyOn(source, 'getRepresentation');
|
const getRepresentationSpy = jest.spyOn(source, 'getRepresentation');
|
||||||
|
getRepresentationSpy.mockReturnValue(new Promise((resolve): any => resolve({ data:
|
||||||
|
streamifyArray([ 1, 2, 3 ]) } as Representation)));
|
||||||
|
|
||||||
const representation = await store.getRepresentation({ path }, {});
|
const representation = await store.getRepresentation({ path }, {});
|
||||||
const errorCallback = jest.fn();
|
const errorCallback = jest.fn();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user