@@ -261,8 +245,8 @@ export const ResourcePage = (): React.JSX.Element => {
{currentPage === aboutPageId && (
diff --git a/frontend/resourceadm/testing/playwright/package.json b/frontend/resourceadm/testing/playwright/package.json
index e8e73299949..a5ca9ad4215 100644
--- a/frontend/resourceadm/testing/playwright/package.json
+++ b/frontend/resourceadm/testing/playwright/package.json
@@ -9,7 +9,7 @@
"devDependencies": {
"@playwright/test": "^1.41.1",
"@types/dotenv": "^8.2.0",
- "@types/node": "^20.10.5",
+ "@types/node": "^22.0.0",
"ts-node": "^10.9.2"
},
"scripts": {
diff --git a/frontend/resourceadm/types/NavigationBarPage.d.ts b/frontend/resourceadm/types/NavigationBarPage.d.ts
index 998f945b7fd..ed2d6cf82f5 100644
--- a/frontend/resourceadm/types/NavigationBarPage.d.ts
+++ b/frontend/resourceadm/types/NavigationBarPage.d.ts
@@ -1 +1,7 @@
-export type NavigationBarPage = 'about' | 'policy' | 'deploy' | 'migration' | 'accesslists';
+export type NavigationBarPage =
+ | 'about'
+ | 'policy'
+ | 'deploy'
+ | 'migration'
+ | 'accesslists'
+ | 'back';
diff --git a/frontend/resourceadm/utils/resourceUtils/index.ts b/frontend/resourceadm/utils/resourceUtils/index.ts
index 49f1c9dd78e..7c03247d9f7 100644
--- a/frontend/resourceadm/utils/resourceUtils/index.ts
+++ b/frontend/resourceadm/utils/resourceUtils/index.ts
@@ -1,8 +1,6 @@
export {
mapLanguageKeyToLanguageText,
getMissingInputLanguageString,
- getIsActiveTab,
- createNavigationTab,
getResourceIdentifierErrorMessage,
deepCompare,
getAvailableEnvironments,
@@ -14,5 +12,6 @@ export {
resourceTypeMap,
validateResource,
getAltinn2Reference,
+ getMigrationErrorMessage,
} from './resourceUtils';
export type { EnvId, Environment } from './resourceUtils';
diff --git a/frontend/resourceadm/utils/resourceUtils/resourceUtils.test.tsx b/frontend/resourceadm/utils/resourceUtils/resourceUtils.test.tsx
index 99c6088e80b..939514e7eab 100644
--- a/frontend/resourceadm/utils/resourceUtils/resourceUtils.test.tsx
+++ b/frontend/resourceadm/utils/resourceUtils/resourceUtils.test.tsx
@@ -1,18 +1,15 @@
import {
- createNavigationTab,
- getIsActiveTab,
getMissingInputLanguageString,
mapLanguageKeyToLanguageText,
deepCompare,
getEnvLabel,
mapKeywordStringToKeywordTypeArray,
validateResource,
+ getMigrationErrorMessage,
} from './';
import type { EnvId } from './resourceUtils';
-import type { LeftNavigationTab } from '../../components/LeftNavigationBar';
-import { TestFlaskIcon } from '@studio/icons';
-import React from 'react';
-import type { Resource, SupportedLanguage } from 'app-shared/types/ResourceAdm';
+import type { Resource, ResourceError, SupportedLanguage } from 'app-shared/types/ResourceAdm';
+import { ServerCodes } from 'app-shared/enums/ServerCodes';
describe('mapKeywordStringToKeywordTypeArray', () => {
it('should split keywords correctly', () => {
@@ -107,42 +104,6 @@ describe('getMissingInputLanguageString', () => {
});
});
-describe('getIsActiveTab', () => {
- it('returns true when current page and tab id mathces', () => {
- const isActive = getIsActiveTab('about', 'about');
- expect(isActive).toBeTruthy();
- });
-
- it('returns false when current page and tab id does not match', () => {
- const isActive = getIsActiveTab('about', 'policy');
- expect(isActive).toBeFalsy();
- });
-});
-
-describe('createNavigationTab', () => {
- const mockOnClick = jest.fn();
-
- const mockTo: string = '/about';
-
- const mockTab: LeftNavigationTab = {
- icon:
,
- tabName: 'resourceadm.left_nav_bar_about',
- tabId: 'about',
- action: {
- type: 'link',
- onClick: mockOnClick,
- to: mockTo,
- },
- isActiveTab: true,
- };
-
- it('creates a new tab when the function is called', () => {
- const newTab = createNavigationTab(
, 'about', mockOnClick, 'about', mockTo);
-
- expect(newTab).toEqual(mockTab);
- });
-});
-
describe('deepCompare', () => {
it('should return true for equal objects', () => {
const obj1 = {
@@ -260,3 +221,45 @@ describe('deepCompare', () => {
});
});
});
+
+describe('getMigrationErrorMessage', () => {
+ it('returns no error', () => {
+ const error = getMigrationErrorMessage(null, null, true);
+ expect(error).toBeNull();
+ });
+
+ it('returns error when start migration status is forbidden', () => {
+ const migrateError = { response: { status: ServerCodes.Forbidden } };
+ const error = getMigrationErrorMessage(null, migrateError as ResourceError, true);
+ expect(error.errorMessage).toEqual('resourceadm.migration_no_migration_access');
+ });
+
+ it('returns error when start migration failed', () => {
+ const migrateError = { response: { status: ServerCodes.InternalServerError } };
+ const error = getMigrationErrorMessage(null, migrateError as ResourceError, true);
+ expect(error.errorMessage).toEqual('resourceadm.migration_post_migration_failed');
+ });
+
+ it('returns error when service is not found', () => {
+ const loadDelegationCountError = { response: { status: ServerCodes.NotFound } };
+ const error = getMigrationErrorMessage(loadDelegationCountError as ResourceError, null, true);
+ expect(error.errorMessage).toEqual('resourceadm.migration_service_not_found');
+ });
+
+ it('returns error when service cannot be migrated in environment', () => {
+ const loadDelegationCountError = { response: { status: ServerCodes.Forbidden } };
+ const error = getMigrationErrorMessage(loadDelegationCountError as ResourceError, null, true);
+ expect(error.errorMessage).toEqual('resourceadm.migration_cannot_migrate_in_env');
+ });
+
+ it('returns error when unknown error occurs', () => {
+ const loadDelegationCountError = { response: { status: ServerCodes.InternalServerError } };
+ const error = getMigrationErrorMessage(loadDelegationCountError as ResourceError, null, true);
+ expect(error.errorMessage).toEqual('resourceadm.migration_technical_error');
+ });
+
+ it('returns error when resource is not published', () => {
+ const error = getMigrationErrorMessage(null, null, false);
+ expect(error.errorMessage).toEqual('resourceadm.migration_not_published');
+ });
+});
diff --git a/frontend/resourceadm/utils/resourceUtils/resourceUtils.ts b/frontend/resourceadm/utils/resourceUtils/resourceUtils.ts
index 19122d97839..b6d04538588 100644
--- a/frontend/resourceadm/utils/resourceUtils/resourceUtils.ts
+++ b/frontend/resourceadm/utils/resourceUtils/resourceUtils.ts
@@ -1,5 +1,4 @@
import type { KeyValuePairs } from 'app-shared/types/KeyValuePairs';
-import type { LeftNavigationTab } from '../../components/LeftNavigationBar';
import type {
ResourceTypeOption,
ResourceStatusOption,
@@ -9,10 +8,10 @@ import type {
SupportedLanguage,
Resource,
ResourceFormError,
+ ResourceError,
} from 'app-shared/types/ResourceAdm';
-import type { ReactNode } from 'react';
-import type { NavigationBarPage } from '../../types/NavigationBarPage';
import { isAppPrefix, isSePrefix } from '../stringUtils';
+import { ServerCodes } from 'app-shared/enums/ServerCodes';
/**
* The map of resource type
@@ -154,50 +153,6 @@ export const mapKeywordStringToKeywordTypeArray = (keywrodString: string): Resou
.map((val) => ({ language: 'nb', word: val.trim() }));
};
-/**
- * Gets the status for if a tab is active or not based on the
- * current page and the tabs id.
- *
- * @param currentPage the currently selected tab
- * @param tabId the id of the tab to check
- *
- * @returns if the tab is active or not
- */
-export const getIsActiveTab = (currentPage: NavigationBarPage, tabId: string): boolean => {
- return currentPage === tabId;
-};
-
-/**
- * Creates a new navigation tab to be used in the LeftNavigationBar
- *
- * @param icon the icon to display
- * @param tabId the id of the tab
- * @param onClick function to be executed on click
- * @param currentPage the current selected page
- * @param to where to navigate to
- *
- * @returns a LeftNavigationTab
- */
-export const createNavigationTab = (
- icon: ReactNode,
- tabId: string,
- onClick: (tabId: string) => void,
- currentPage: NavigationBarPage,
- to: string,
-): LeftNavigationTab => {
- return {
- icon,
- tabName: `resourceadm.left_nav_bar_${tabId}`,
- tabId,
- action: {
- type: 'link',
- onClick,
- to,
- },
- isActiveTab: getIsActiveTab(currentPage, tabId),
- };
-};
-
export const getResourceIdentifierErrorMessage = (identifier: string, isConflict?: boolean) => {
const hasAppPrefix = isAppPrefix(identifier);
const hasSePrefix = isSePrefix(identifier);
@@ -246,11 +201,14 @@ export const deepCompare = (original: any, changed: any) => {
};
export const validateResource = (
- resourceData: Resource,
+ resourceData: Resource | undefined,
t: (key: string, params?: KeyValuePairs
) => string,
): ResourceFormError[] => {
const errors: ResourceFormError[] = [];
+ if (!resourceData) {
+ return [];
+ }
// validate resourceType
if (!Object.keys(resourceTypeMap).includes(resourceData.resourceType)) {
errors.push({
@@ -440,3 +398,46 @@ export const getAltinn2Reference = (
)?.reference;
return serviceCode && serviceEdition ? [serviceCode, serviceEdition] : null;
};
+
+export const getMigrationErrorMessage = (
+ loadDelegationCountError: Error | null,
+ migrateDelegationsError: Error | null,
+ isPublishedInEnv: boolean,
+): {
+ errorMessage: string;
+ severity: 'success' | 'warning' | 'danger';
+} | null => {
+ const loadErrorStatus = (loadDelegationCountError as ResourceError)?.response.status;
+ const isErrorForbidden =
+ (migrateDelegationsError as ResourceError)?.response?.status === ServerCodes.Forbidden;
+
+ if (migrateDelegationsError) {
+ return {
+ errorMessage: isErrorForbidden
+ ? 'resourceadm.migration_no_migration_access'
+ : 'resourceadm.migration_post_migration_failed',
+ severity: 'danger',
+ };
+ } else if (loadErrorStatus === ServerCodes.NotFound) {
+ return {
+ errorMessage: 'resourceadm.migration_service_not_found',
+ severity: 'success',
+ };
+ } else if (loadErrorStatus === ServerCodes.Forbidden) {
+ return {
+ errorMessage: 'resourceadm.migration_cannot_migrate_in_env',
+ severity: 'danger',
+ };
+ } else if (loadErrorStatus === ServerCodes.InternalServerError) {
+ return {
+ errorMessage: 'resourceadm.migration_technical_error',
+ severity: 'danger',
+ };
+ } else if (!isPublishedInEnv) {
+ return {
+ errorMessage: 'resourceadm.migration_not_published',
+ severity: 'warning',
+ };
+ }
+ return null;
+};
diff --git a/frontend/scripts/package.json b/frontend/scripts/package.json
index 296b2e6950c..8cf50fecdf9 100644
--- a/frontend/scripts/package.json
+++ b/frontend/scripts/package.json
@@ -1,7 +1,7 @@
{
"name": "altinn-studio-internal-stats",
"dependencies": {
- "axios": "1.7.8"
+ "axios": "1.7.9"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "7.18.0",
diff --git a/frontend/scripts/yarn.lock b/frontend/scripts/yarn.lock
index a4a1fe955fa..870201d051e 100644
--- a/frontend/scripts/yarn.lock
+++ b/frontend/scripts/yarn.lock
@@ -370,7 +370,7 @@ __metadata:
dependencies:
"@typescript-eslint/eslint-plugin": "npm:7.18.0"
"@typescript-eslint/parser": "npm:7.18.0"
- axios: "npm:1.7.8"
+ axios: "npm:1.7.9"
eslint: "npm:8.57.1"
eslint-plugin-import: "npm:2.31.0"
glob: "npm:11.0.0"
@@ -570,14 +570,14 @@ __metadata:
languageName: node
linkType: hard
-"axios@npm:1.7.8":
- version: 1.7.8
- resolution: "axios@npm:1.7.8"
+"axios@npm:1.7.9":
+ version: 1.7.9
+ resolution: "axios@npm:1.7.9"
dependencies:
follow-redirects: "npm:^1.15.6"
form-data: "npm:^4.0.0"
proxy-from-env: "npm:^1.1.0"
- checksum: 10/7ddcde188041ac55090186254b4025eb2af842be3cf615ce45393fd7f543c1eab0ad2fdd2017a5f6190695e3ecea73ee5e9c37f204854aec2698f9579046efdf
+ checksum: 10/b7a5f660ea53ba9c2a745bf5ad77ad8bf4f1338e13ccc3f9f09f810267d6c638c03dac88b55dae8dc98b79c57d2d6835be651d58d2af97c174f43d289a9fd007
languageName: node
linkType: hard
diff --git a/frontend/studio-root/app/App.tsx b/frontend/studio-root/app/App.tsx
index 6f86bf1ab7e..bb433c3e175 100644
--- a/frontend/studio-root/app/App.tsx
+++ b/frontend/studio-root/app/App.tsx
@@ -4,10 +4,10 @@ import { Route, Routes } from 'react-router-dom';
import { StudioNotFoundPage } from '@studio/components';
import { Paragraph, Link } from '@digdir/designsystemet-react';
import { useTranslation, Trans } from 'react-i18next';
-
import './App.css';
import { PageLayout } from '../pages/PageLayout';
import { ContactPage } from '../pages/Contact/ContactPage';
+import { FlagsPage } from '../pages/FlagsPage';
export const App = (): JSX.Element => {
return (
@@ -15,6 +15,7 @@ export const App = (): JSX.Element => {
}>
} />
+ } />
} />
diff --git a/frontend/studio-root/pages/FlagsPage/FlagsPage.module.css b/frontend/studio-root/pages/FlagsPage/FlagsPage.module.css
new file mode 100644
index 00000000000..05642c64ac6
--- /dev/null
+++ b/frontend/studio-root/pages/FlagsPage/FlagsPage.module.css
@@ -0,0 +1,6 @@
+.root {
+ display: flex;
+ flex-direction: column;
+ gap: var(--fds-spacing-3);
+ padding: var(--fds-spacing-6);
+}
diff --git a/frontend/studio-root/pages/FlagsPage/FlagsPage.test.tsx b/frontend/studio-root/pages/FlagsPage/FlagsPage.test.tsx
new file mode 100644
index 00000000000..29e2f87332f
--- /dev/null
+++ b/frontend/studio-root/pages/FlagsPage/FlagsPage.test.tsx
@@ -0,0 +1,57 @@
+import { FeatureFlag } from 'app-shared/utils/featureToggleUtils';
+import { typedLocalStorage } from '@studio/pure-functions'; // Todo: Move this to a more suitable place: https://github.com/Altinn/altinn-studio/issues/14230
+import type { RenderResult } from '@testing-library/react';
+import { render, screen } from '@testing-library/react';
+import { FlagsPage } from './FlagsPage';
+import React from 'react';
+import { userEvent } from '@testing-library/user-event';
+
+const flags: FeatureFlag[] = Object.values(FeatureFlag);
+
+describe('FlagsPage', () => {
+ beforeEach(() => typedLocalStorage.removeItem('featureFlags'));
+
+ it('Renders a checkbox for each flag', () => {
+ renderFlagsPage();
+ flags.forEach((flag) => {
+ expect(screen.getByRole('checkbox', { name: flag })).toBeInTheDocument();
+ });
+ });
+
+ it('Renders the chechkboxes as unchecked by default', () => {
+ renderFlagsPage();
+ flags.forEach((flag) => {
+ expect(screen.getByRole('checkbox', { name: flag })).not.toBeChecked();
+ });
+ });
+
+ it('Renders the chechkbox as checked when the corresponding flag is enabled', () => {
+ const enabledFlag = flags[0];
+ typedLocalStorage.setItem('featureFlags', [enabledFlag]);
+ renderFlagsPage();
+ expect(screen.getByRole('checkbox', { name: enabledFlag })).toBeChecked();
+ });
+
+ it('Adds the flag to the list of enabled flags when the user checks the checkbox', async () => {
+ const user = userEvent.setup();
+ renderFlagsPage();
+ const flagToEnable = flags[0];
+ const checkbox = screen.getByRole('checkbox', { name: flagToEnable });
+ await user.click(checkbox);
+ expect(typedLocalStorage.getItem('featureFlags')).toEqual([flagToEnable]);
+ });
+
+ it('Removes the flag from the list of enabled flags when the user unchecks the checkbox', async () => {
+ const user = userEvent.setup();
+ const enabledFlag = flags[0];
+ typedLocalStorage.setItem('featureFlags', [enabledFlag]);
+ renderFlagsPage();
+ const checkbox = screen.getByRole('checkbox', { name: enabledFlag });
+ await user.click(checkbox);
+ expect(typedLocalStorage.getItem('featureFlags')).toEqual([]);
+ });
+});
+
+function renderFlagsPage(): RenderResult {
+ return render();
+}
diff --git a/frontend/studio-root/pages/FlagsPage/FlagsPage.tsx b/frontend/studio-root/pages/FlagsPage/FlagsPage.tsx
new file mode 100644
index 00000000000..b5c62f72689
--- /dev/null
+++ b/frontend/studio-root/pages/FlagsPage/FlagsPage.tsx
@@ -0,0 +1,51 @@
+import type { ChangeEvent, ReactElement } from 'react';
+import React, { useCallback, useState } from 'react';
+import { isFeatureActivatedByLocalStorage, FeatureFlag } from 'app-shared/utils/featureToggleUtils';
+import { StudioSwitch, StudioCodeFragment, StudioHeading } from '@studio/components';
+import { setFeatureFlagInLocalStorage } from './setFeatureFlagInLocalStorage';
+import classes from './FlagsPage.module.css';
+import { useTranslation } from 'react-i18next';
+
+export function FlagsPage(): ReactElement {
+ const { t } = useTranslation();
+
+ return (
+
+ {t('feature_flags.heading')}
+
+
+ );
+}
+
+function FlagList(): ReactElement {
+ return (
+ <>
+ {Object.values(FeatureFlag).map((flag) => {
+ return ;
+ })}
+ >
+ );
+}
+
+type FeatureFlagProps = {
+ flagName: FeatureFlag;
+};
+
+function Flag({ flagName }: FeatureFlagProps): ReactElement {
+ const [enabled, setEnabled] = useState(isFeatureActivatedByLocalStorage(flagName));
+
+ const handleToggle = useCallback(
+ (e: ChangeEvent): void => {
+ const { checked } = e.target;
+ setFeatureFlagInLocalStorage(flagName, checked);
+ setEnabled(checked);
+ },
+ [flagName, setEnabled],
+ );
+
+ return (
+
+ {flagName}
+
+ );
+}
diff --git a/frontend/studio-root/pages/FlagsPage/index.ts b/frontend/studio-root/pages/FlagsPage/index.ts
new file mode 100644
index 00000000000..dd833255979
--- /dev/null
+++ b/frontend/studio-root/pages/FlagsPage/index.ts
@@ -0,0 +1 @@
+export * from './FlagsPage';
diff --git a/frontend/studio-root/pages/FlagsPage/setFeatureFlagInLocalStorage.test.ts b/frontend/studio-root/pages/FlagsPage/setFeatureFlagInLocalStorage.test.ts
new file mode 100644
index 00000000000..c58aacbe0cf
--- /dev/null
+++ b/frontend/studio-root/pages/FlagsPage/setFeatureFlagInLocalStorage.test.ts
@@ -0,0 +1,20 @@
+import { typedLocalStorage } from '@studio/pure-functions'; // Todo: Move this to a more suitable place: https://github.com/Altinn/altinn-studio/issues/14230
+import { setFeatureFlagInLocalStorage } from './setFeatureFlagInLocalStorage';
+import type { FeatureFlag } from 'app-shared/utils/featureToggleUtils';
+
+const testFlag = 'testFeature' as FeatureFlag; // Using casting here instead of a real flag because the list will change over time
+
+describe('setFeatureFlagInLocalStorage', () => {
+ beforeEach(() => typedLocalStorage.removeItem('featureFlags'));
+
+ it('Adds the feature flag to the local storage when the state is true', () => {
+ setFeatureFlagInLocalStorage(testFlag, true);
+ expect(typedLocalStorage.getItem('featureFlags')).toEqual([testFlag]);
+ });
+
+ it('Removes the feature flag from the local storage when the state is false', () => {
+ typedLocalStorage.setItem('featureFlags', [testFlag]);
+ setFeatureFlagInLocalStorage(testFlag, false);
+ expect(typedLocalStorage.getItem('featureFlags')).toEqual([]);
+ });
+});
diff --git a/frontend/studio-root/pages/FlagsPage/setFeatureFlagInLocalStorage.ts b/frontend/studio-root/pages/FlagsPage/setFeatureFlagInLocalStorage.ts
new file mode 100644
index 00000000000..6b0dad1e7f7
--- /dev/null
+++ b/frontend/studio-root/pages/FlagsPage/setFeatureFlagInLocalStorage.ts
@@ -0,0 +1,14 @@
+import type { FeatureFlag } from 'app-shared/utils/featureToggleUtils';
+import {
+ addFeatureFlagToLocalStorage,
+ removeFeatureFlagFromLocalStorage,
+} from 'app-shared/utils/featureToggleUtils';
+
+export function setFeatureFlagInLocalStorage(flag: FeatureFlag, state: boolean): void {
+ const changeInLocalStorage = retrieveChangeFunction(state);
+ return changeInLocalStorage(flag);
+}
+
+function retrieveChangeFunction(state: boolean): (flag: FeatureFlag) => void {
+ return state ? addFeatureFlagToLocalStorage : removeFeatureFlagFromLocalStorage;
+}
diff --git a/frontend/testing/cypress/package.json b/frontend/testing/cypress/package.json
index 3afda542a3c..f31efe32e97 100644
--- a/frontend/testing/cypress/package.json
+++ b/frontend/testing/cypress/package.json
@@ -5,7 +5,7 @@
"devDependencies": {
"@testing-library/cypress": "10.0.2",
"axe-core": "4.10.2",
- "cypress": "13.16.0",
+ "cypress": "13.16.1",
"cypress-axe": "1.5.0",
"cypress-plugin-tab": "1.0.5",
"eslint": "8.57.1"
diff --git a/frontend/testing/playwright/package.json b/frontend/testing/playwright/package.json
index 27627af7599..595ec32cb9d 100644
--- a/frontend/testing/playwright/package.json
+++ b/frontend/testing/playwright/package.json
@@ -9,7 +9,7 @@
"devDependencies": {
"@playwright/test": "^1.41.1",
"@types/dotenv": "^8.2.0",
- "@types/node": "^20.10.5",
+ "@types/node": "^22.0.0",
"ts-node": "^10.9.2"
},
"scripts": {
diff --git a/frontend/testing/setupTests.ts b/frontend/testing/setupTests.ts
index cd00ba0cb63..53dfd272de1 100644
--- a/frontend/testing/setupTests.ts
+++ b/frontend/testing/setupTests.ts
@@ -11,6 +11,9 @@ import type { WithTranslationProps } from 'react-i18next';
failOnConsole({
shouldFailOnWarn: true,
+ silenceMessage(message) {
+ return /React Router Future Flag Warning/.test(message); // TODO: remove when react router has been updated to v7
+ },
});
Object.defineProperty(window, 'matchMedia', {
diff --git a/package.json b/package.json
index 053724c3368..f3293a304ad 100644
--- a/package.json
+++ b/package.json
@@ -10,8 +10,8 @@
"@microsoft/applicationinsights-react-js": "17.3.4",
"@microsoft/applicationinsights-web": "3.3.4",
"@microsoft/signalr": "8.0.7",
- "@tanstack/react-query": "5.62.0",
- "@tanstack/react-query-devtools": "5.62.0",
+ "@tanstack/react-query": "5.62.2",
+ "@tanstack/react-query-devtools": "5.62.2",
"ajv": "8.17.1",
"ajv-formats": "3.0.1",
"i18next": "23.16.8",
@@ -20,21 +20,21 @@
"react-dom": "18.3.1",
"react-error-boundary": "4.1.2",
"react-i18next": "15.1.3",
- "react-router-dom": "6.27.0",
+ "react-router-dom": "6.28.0",
"react-toastify": "10.0.6"
},
"devDependencies": {
"@svgr/webpack": "8.1.0",
- "@swc/core": "1.9.3",
+ "@swc/core": "1.10.0",
"@swc/jest": "0.2.37",
"@testing-library/dom": "10.4.0",
"@testing-library/jest-dom": "6.6.3",
- "@testing-library/react": "16.0.1",
+ "@testing-library/react": "16.1.0",
"@testing-library/user-event": "14.5.2",
"@types/css-modules": "1.0.5",
"@types/jest": "29.5.14",
- "@types/react": "18.3.12",
- "@types/react-dom": "18.3.1",
+ "@types/react": "18.3.14",
+ "@types/react-dom": "18.3.2",
"@typescript-eslint/eslint-plugin": "7.18.0",
"@typescript-eslint/parser": "7.18.0",
"cross-env": "7.0.3",
@@ -44,8 +44,8 @@
"eslint-plugin-import": "2.31.0",
"eslint-plugin-jsx-a11y": "6.10.2",
"eslint-plugin-react": "7.37.2",
- "eslint-plugin-react-hooks": "4.6.2",
- "eslint-plugin-testing-library": "6.5.0",
+ "eslint-plugin-react-hooks": "5.1.0",
+ "eslint-plugin-testing-library": "7.1.1",
"glob": "11.0.0",
"husky": "9.1.7",
"jest": "29.7.0",
@@ -54,21 +54,21 @@
"jest-junit": "16.0.0",
"lint-staged": "15.2.10",
"mini-css-extract-plugin": "2.9.2",
- "prettier": "3.4.1",
+ "prettier": "3.4.2",
"source-map-loader": "5.0.0",
"swc-loader": "0.2.6",
"terser-webpack-plugin": "5.3.10",
"typescript": "5.7.2",
"typescript-plugin-css-modules": "5.1.0",
- "webpack": "5.96.1",
+ "webpack": "5.97.1",
"webpack-cli": "5.1.4",
"webpack-dev-server": "5.1.0",
"whatwg-fetch": "3.6.20"
},
"resolutions": {
"@testing-library/dom": "10.4.0",
- "@babel/traverse": "7.25.9",
- "caniuse-lite": "1.0.30001685"
+ "@babel/traverse": "7.26.4",
+ "caniuse-lite": "1.0.30001687"
},
"lint-staged": {
"*{js,jsx,tsx,ts,css,md}": "prettier -w",
diff --git a/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient.Tests/Altinn.EFormidlingClient.Tests.csproj b/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient.Tests/Altinn.EFormidlingClient.Tests.csproj
deleted file mode 100644
index c09d2e97678..00000000000
--- a/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient.Tests/Altinn.EFormidlingClient.Tests.csproj
+++ /dev/null
@@ -1,67 +0,0 @@
-
-
-
- netcoreapp3.1
- false
-
-
-
-
- Always
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- runtime; build; native; contentfiles; analyzers; buildtransitive
- all
-
-
- runtime; build; native; contentfiles; analyzers; buildtransitive
- all
-
-
-
-
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
- stylecop.json
-
-
-
-
- ..\Altinn3.ruleset
-
-
-
- true
- $(NoWarn);1591
-
-
-
- 1701;1702;1591
-
-
-
-
-
-
-
-
- Always
-
-
-
diff --git a/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient.Tests/TestData/arkivmelding.xml b/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient.Tests/TestData/arkivmelding.xml
deleted file mode 100644
index 2e5aa494241..00000000000
--- a/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient.Tests/TestData/arkivmelding.xml
+++ /dev/null
@@ -1,78 +0,0 @@
-
-
- LandLord
- 3380ed76-5d4c-43e7-aa70-8ed8d97e4835
- 2017-05-23T12:46:00
- 1
-
-
- 43fbe161-7aac-4c9f-a888-d8167aab4144
- Nye lysrør Hauketo Skole
- 2017-06-01T10:10:12.000+01:00
-
-
- Funksjoner
- vedlikehold av skole
- vedlikehold av skole
- 2017-05-23T21:56:12.000+01:00
- Knut Hansen
-
-
- Objekter
- 20500
- Hauketo Skole
- 2017-05-23T21:56:12.000+01:00
- Knut Hansen
-
-
- 430a6710-a3d4-4863-8bd0-5eb1021bee45
- 2012-02-17T21:56:12.000+01:00
- LandLord
- 2012-02-17T21:56:12.000+01:00
- LandLord
- 43fbe161-7aac-4c9f-a888-d8167aab4144
-
- 3e518e5b-a361-42c7-8668-bcbb9eecf18d
- Bestilling
- Dokumentet er ferdigstilt
- Bestilling - nye lysrør
- 2012-02-17T21:56:12.000+01:00
- Landlord
- Hoveddokument
- 1
- 2012-02-17T21:56:12.000+01:00
- Landlord
-
- 1
- Produksjonsformat
- 2012-02-17T21:56:12.000+01:00
- Landlord
- test.pdf
-
-
- Nye lysrør
- Nye lysrør
-
-
- 20050
- Hauketo Skole
- 200501
- 2005001
- Materiell, elektro
- K-123123-elektriker
-
-
- Utgående dokument
- Journalført
- 2017-05-23
-
- Mottaker
- elektrikeren AS, Veien 100, Oslo
-
-
- 2017-06-01
- Blah
- KNUTKÅRE
- Avsluttet
-
-
diff --git a/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient.Tests/TestData/arkivmelding2.xml b/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient.Tests/TestData/arkivmelding2.xml
deleted file mode 100644
index 0183136a6ca..00000000000
--- a/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient.Tests/TestData/arkivmelding2.xml
+++ /dev/null
@@ -1,80 +0,0 @@
-
-
- SaMock
- 3380ed76-5d4c-43e7-aa70-8ed8d97e4835
- 2017-05-23T12:46:00
- 1
-
-
- 43fbe161-7aac-4c9f-a888-d8167aab4144
- En tittel
- 2017-06-01T10:10:12.000+01:00
-
-
- Funksjoner
- KlasseId
- En tittel
- 2017-05-23T21:56:12.000+01:00
- SaMock
-
-
- Objekter
- 20500
- En tittel
- 2017-05-23T21:56:12.000+01:00
- SaMock
-
-
- 430a6710-a3d4-4863-8bd0-5eb1021bee45
- 2012-02-17T21:56:12.000+01:00
- SaMock
- 2012-02-17T21:56:12.000+01:00
- SaMock
- 43fbe161-7aac-4c9f-a888-d8167aab4144
-
- 3e518e5b-a361-42c7-8668-bcbb9eecf18d
- Bestilling
- Dokumentet er ferdigstilt
- Eksempeldokument
- 2012-02-17T21:56:12.000+01:00
- SaMock
- Hoveddokument
- 1
- 2012-02-17T21:56:12.000+01:00
- SaMock
-
- 1
- Produksjonsformat
- 2012-02-17T21:56:12.000+01:00
- Landlord
- test.pdf
-
-
- En tittel
- En offentlig tittel
-
-
- 20050
- Objektnavn
- 200501
- 2005001
- Materiell, elektro
- K-123123-asd
-
-
- Utgående dokument
- Journalført
- 2017-05-23
-
- Mottaker
- Mottakers navn
-
-
- 2017-06-01
- Admenhet
- Saksansvarlig
- Avsluttet
-
-
diff --git a/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient.Tests/TestData/arkivmeldingInvalid.xml b/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient.Tests/TestData/arkivmeldingInvalid.xml
deleted file mode 100644
index f9b0dc14742..00000000000
--- a/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient.Tests/TestData/arkivmeldingInvalid.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
- LandLord
- 3380ed76-5d4c-43e7-aa70-8ed8d97e4835
- 2017-05-23T12:46:00
- 1
-
-
- 43fbe161-7aac-4c9f-a888-d8167aab4144
- Nye lysrør Hauketo Skole
- 2017-06-01T10:10:12.000+01:00
-
-
-
- 430a6710-a3d4-4863-8bd0-5eb1021bee45
- 2012-02-17T21:56:12.000+01:00
- LandLord
- 2012-02-17T21:56:12.000+01:00
- LandLord
- 43fbe161-7aac-4c9f-a888-d8167aab4144
-
- 3e518e5b-a361-42c7-8668-bcbb9eecf18d
- Bestilling
- Dokumentet er ferdigstilt
- Bestilling - nye lysrør
- 2012-02-17T21:56:12.000+01:00
- Landlord
- Hoveddokument
- 1
- 2012-02-17T21:56:12.000+01:00
- Landlord
-
-
- Nye lysrør
- Nye lysrør
- Utgående dokument
- Journalført
- 2017-05-23
-
-
-
-
-
diff --git a/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient.Tests/TestData/sbd.json b/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient.Tests/TestData/sbd.json
deleted file mode 100644
index 4c1c3f6a93a..00000000000
--- a/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient.Tests/TestData/sbd.json
+++ /dev/null
@@ -1,47 +0,0 @@
-{
- "standardBusinessDocumentHeader": {
- "headerVersion": "1.0",
- "sender": [
- {
- "identifier": {
- "value": "0192:910075918",
- "authority": "iso6523-actorid-upis"
- },
- "contactInformation": []
- }
- ],
- "receiver": [
- {
- "identifier": {
- "value": "0192:910075918",
- "authority": "iso6523-actorid-upis"
- },
- "contactInformation": []
- }
- ],
- "documentIdentification": {
- "instanceIdentifier": "dddf6910-6bde-11eb-83f7-e5be6c2ac43bo",
- "standard": "urn:no:difi:arkivmelding:xsd::arkivmelding",
- "typeVersion": "2.0",
- "type": "arkivmelding",
- "creationDateAndTime": "2020-01-09T15:45:51+01:00"
- },
- "businessScope": {
- "scope": [
- {
- "type": "ConversationId",
- "instanceIdentifier": "dddfb730-6bde-11eb-83f7-e5be6c2ac43o",
- "identifier": "urn:no:difi:profile:arkivmelding:administrasjon:ver1.0",
- "scopeInformation": [
- {
- "expectedResponseDateTime": "2021-02-27T23:59:00+01:00"
- }
- ]
- }
- ]
- }
- },
- "arkivmelding": {
- "sikkerhetsnivaa": 3
- }
-}
diff --git a/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient.Tests/TestData/sbdInvalid.json b/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient.Tests/TestData/sbdInvalid.json
deleted file mode 100644
index ac9ccf30218..00000000000
--- a/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient.Tests/TestData/sbdInvalid.json
+++ /dev/null
@@ -1,47 +0,0 @@
-{
- "standardBusinessDocumentHeaderTest": {
- "headerVersion": "1.0",
- "sender": [
- {
- "identifier": {
- "value": "0192:910075918",
- "authority": "iso6523-actorid-upis"
- },
- "contactInformation": []
- }
- ],
- "receiver": [
- {
- "identifier": {
- "value": "0192:910075918",
- "authority": "iso6523-actorid-upis"
- },
- "contactInformation": []
- }
- ],
- "documentIdentification": {
- "instanceIdentifier": "dddf6910-6bde-11eb-83f7-e5be6c2ac43bo",
-
- "typeVersion": "2.0",
- "type": "arkivmelding",
- "creationDateAndTime": "2020-01-09T15:45:51+01:00"
- },
- "businessScope": {
- "scope": [
- {
- "type": "ConversationId",
- "instanceIdentifier": "dddfb730-6bde-11eb-83f7-e5be6c2ac43o",
- "identifier": "urn:no:difi:profile:arkivmelding:administrasjon:ver1.0",
- "scopeInformation": [
- {
- "expectedResponseDateTime": "2021-02-27T23:59:00+01:00"
- }
- ]
- }
- ]
- }
- },
- "arkivmeldingTest": {
- "sikkerhetsnivaa": 3
- }
-}
diff --git a/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient.Tests/TestData/test.pdf b/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient.Tests/TestData/test.pdf
deleted file mode 100644
index 7d349b8f759..00000000000
Binary files a/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient.Tests/TestData/test.pdf and /dev/null differ
diff --git a/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient.Tests/UnitTest/EFormidlingClientUnitTest.cs b/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient.Tests/UnitTest/EFormidlingClientUnitTest.cs
deleted file mode 100644
index 0df2eeb63b6..00000000000
--- a/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient.Tests/UnitTest/EFormidlingClientUnitTest.cs
+++ /dev/null
@@ -1,301 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Net.Http;
-using System.Text.Json;
-using System.Xml.Serialization;
-using Altinn.Common.EFormidlingClient;
-using Altinn.Common.EFormidlingClient.Configuration;
-using Altinn.Common.EFormidlingClient.Models;
-using Altinn.Common.EFormidlingClient.Models.SBD;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Logging.Console;
-using Microsoft.Extensions.Logging.Debug;
-using Xunit;
-using Arkivmelding = Altinn.Common.EFormidlingClient.Models.Arkivmelding;
-
-namespace Altinn.EFormidlingClient.Tests.ClientUnitTest
-{
- ///
- /// Represents a collection of unit test, testing the class.
- ///
- public class EFormidlingClientUnitTest : IClassFixture
- {
- private readonly ServiceProvider _serviceProvider;
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// Fixture for setup
- public EFormidlingClientUnitTest(FixtureUnit fixture)
- {
- _serviceProvider = fixture.ServiceProvider;
- }
-
- ///
- /// Test valid sbd json from file
- /// Expected: Not null after deserialization from valid json file
- ///
- [Fact]
- public void Is_Valid_Json()
- {
- var jsonString = File.ReadAllText(@"TestData\sbd.json");
- StandardBusinessDocument sbd = JsonSerializer.Deserialize(jsonString);
-
- Assert.NotNull(sbd);
- }
-
- ///
- /// Test invalid sbd json from file where Arkivmelding and StandardBusinessDocumentHeader are incorrect
- /// Expected: StandardBusinessDocumentHeader and Arkivmelding null
- ///
- [Fact]
- public void Is_Not_Valid_Json()
- {
- var jsonString = File.ReadAllText(@"TestData\sbdInvalid.json");
- StandardBusinessDocument sbd = JsonSerializer.Deserialize(jsonString);
-
- Assert.Null(sbd.Arkivmelding);
- Assert.Null(sbd.StandardBusinessDocumentHeader);
- }
-
- ///
- /// Test valid xml arkivmelding from file
- /// Expected: Serialized arkivmelding is type of Arkivmelding dto
- ///
- [Fact]
- public void Is_Valid_Xml()
- {
- using FileStream fs = File.OpenRead(@"TestData\arkivmelding.xml");
- XmlSerializer serializer = new XmlSerializer(typeof(Arkivmelding));
- Arkivmelding arkivmelding = (Arkivmelding)serializer.Deserialize(fs);
- Assert.NotNull(arkivmelding);
- Assert.Equal(typeof(Arkivmelding), arkivmelding.GetType());
- }
-
- ///
- /// Tests not empty file arkivmelding
- /// Expected: FileStream content is not empty after reading arkivmelding testdata
- ///
- [Fact]
- public void Read_Not_Empty_XML_Test_Data()
- {
- using FileStream fs = File.OpenRead(@"TestData\arkivmelding.xml");
- Assert.True(fs.Length > 0);
- }
-
- ///
- /// Tests valid config in appsettings
- /// Expected: BaseUrl from config is set to localhost
- ///
- [Fact]
- public void Check_Valid_AppConfig()
- {
- var config = FixtureUnit.InitConfiguration();
- var baseUrlSetting = config["EFormidlingClientSettings:BaseUrl"];
- var baseUrlLocal = "http://localhost:9093/api/";
-
- Assert.Equal(baseUrlLocal, baseUrlSetting);
- }
-
- ///
- /// Tests invalid input to GetCapabilities()
- /// Expected: ArgumentNullException is thrown when input parameters are null
- ///
- [Fact]
- public async void Get_Capabilities_Invalid_Input()
- {
- var service = _serviceProvider.GetService();
- ArgumentNullException ex = await Assert.ThrowsAsync(async () => await service.GetCapabilities(string.Empty, null));
- }
-
- ///
- /// Tests invald input to UploadAttachment()
- /// Expected: ArgumentNullException is thrown when input parameters are null
- ///
- [Fact]
- public async void Upload_Attachment_Invalid_Input()
- {
- var service = _serviceProvider.GetService();
- ArgumentNullException ex = await Assert.ThrowsAsync(async () => await service.UploadAttachment(null, string.Empty, string.Empty, null));
- }
-
- ///
- /// Tests invalid input to CreateMessage()
- /// Expected: ArgumentNullException is thrown when input parameters are null
- ///
- [Fact]
- public async void Create_Message_Invalid_Input()
- {
- var service = _serviceProvider.GetService();
- ArgumentNullException ex = await Assert.ThrowsAsync(async () => await service.CreateMessage(null, null));
- }
-
- ///
- /// Tests invalid input to SendMessage()
- /// Expected: ArgumentNullException is thrown when input parameters are null
- ///
- [Fact]
- public async void Send_Message_Invalid_Input()
- {
- var service = _serviceProvider.GetService();
- ArgumentNullException ex = await Assert.ThrowsAsync(async () => await service.SendMessage(null, null));
- }
-
- ///
- /// Tests invalid input to SubscribeeFormiding()
- /// Expected: ArgumentNullException is thrown when input parameters are null
- ///
- [Fact]
- public async void SubscribeeFormidling_Invalid_Input()
- {
- var service = _serviceProvider.GetService();
- ArgumentNullException ex = await Assert.ThrowsAsync(async () => await service.SubscribeeFormidling(null, null));
- }
-
- ///
- /// Tests invalid input to UnSubscribeeFormiding()
- /// Expected: ArgumentNullException is thrown when input parameters are 0 or negative
- ///
- [Fact]
- public async void UnSubscribeeFormidling_Invalid_Input()
- {
- var service = _serviceProvider.GetService();
- ArgumentNullException ex = await Assert.ThrowsAsync(async () => await service.UnSubscribeeFormidling(0, null));
- }
-
- ///
- /// Tests that a custom created arkivmelding is valid according to its model
- /// Expected: Created arkivmelding object is instance of Arkivmelding dto
- ///
- [Fact]
- public void Verify_Arkivmelding_Build()
- {
- Arkivmelding arkivmelding = new Arkivmelding
- {
- AntallFiler = 1,
- Tidspunkt = DateTime.Now.ToString(),
- MeldingId = Guid.NewGuid().ToString(),
- System = "LandLord",
- Mappe = new List
- {
- new Mappe
- {
- SystemID = Guid.NewGuid().ToString(),
- Tittel = "Dette er en tittel",
- OpprettetDato = DateTime.Now.ToString(),
- Type = "saksmappe",
- Basisregistrering = new Basisregistrering
- {
- Type = "journalpost",
- SystemID = Guid.NewGuid().ToString(),
- OpprettetDato = DateTime.UtcNow,
- OpprettetAv = "LandLord",
- ArkivertDato = DateTime.Now,
- ArkivertAv = "LandLord",
- Dokumentbeskrivelse = new Dokumentbeskrivelse
- {
- SystemID = Guid.NewGuid().ToString(),
- Dokumenttype = "Bestilling",
- Dokumentstatus = "Dokumentet er ferdigstilt",
- Tittel = "Hei",
- OpprettetDato = DateTime.UtcNow,
- OpprettetAv = "LandLord",
- TilknyttetRegistreringSom = "hoveddokument",
- Dokumentnummer = 1,
- TilknyttetDato = DateTime.Now,
- TilknyttetAv = "Landlord",
- Dokumentobjekt = new Dokumentobjekt
- {
- Versjonsnummer = 1,
- Variantformat = "Produksjonsformat",
- OpprettetDato = DateTime.UtcNow,
- OpprettetAv = "LandLord",
- ReferanseDokumentfil = "skjema.xml",
- },
- },
- Tittel = "Nye lysrør",
- OffentligTittel = "Nye lysrør",
- Journalposttype = "Utgående dokument",
- Journalstatus = "Journalført",
- Journaldato = DateTime.Now,
- },
- },
- },
- };
-
- MemoryStream stream = new MemoryStream();
- XmlSerializer serializer = new XmlSerializer(typeof(Arkivmelding));
- serializer.Serialize(stream, arkivmelding);
-
- using MemoryStream ms = stream;
- stream.Seek(0, SeekOrigin.Begin);
- var verifiedArkivmelding = serializer.Deserialize(stream) as Arkivmelding;
-
- Assert.NotNull(arkivmelding);
- Assert.Equal(typeof(Arkivmelding), arkivmelding.GetType());
- }
- }
-
- ///
- /// Initializes a new instance of the class
- /// Mocking DI
- ///
- public class FixtureUnit
- {
- ///
- /// Gets the ServiceProvider
- ///
- public ServiceProvider ServiceProvider { get; private set; }
-
- ///
- /// Gets the CustomGuid
- ///
- public string CustomGuid { get; private set; }
-
- ///
- /// Initializes a new instance of the class.
- ///
- public FixtureUnit()
- {
- var serviceCollection = new ServiceCollection();
- var configuration = new ConfigurationBuilder()
- .SetBasePath(Directory.GetCurrentDirectory())
- .AddJsonFile("appsettings.json", optional: false)
- .AddEnvironmentVariables()
- .Build();
-
- serviceCollection.Configure(configuration.GetSection("EFormidlingClientSettings"));
- serviceCollection.AddLogging(config =>
- {
- config.AddDebug();
- config.AddConsole();
- })
- .Configure(options =>
- {
- options.AddFilter(null, LogLevel.Debug);
- options.AddFilter(null, LogLevel.Debug);
- });
-
- serviceCollection.AddTransient();
- _ = serviceCollection.AddTransient();
- ServiceProvider = serviceCollection.BuildServiceProvider();
-
- Guid obj = Guid.NewGuid();
- CustomGuid = obj.ToString();
- }
-
- ///
- /// Gets the CustomGuid
- ///
- public static IConfiguration InitConfiguration()
- {
- var config = new ConfigurationBuilder()
- .AddJsonFile("appsettings.json")
- .Build();
- return config;
- }
- }
-}
diff --git a/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient.Tests/appsettings.json b/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient.Tests/appsettings.json
deleted file mode 100644
index a9aa49d2479..00000000000
--- a/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient.Tests/appsettings.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "EFormidlingClientSettings": {
- "BaseUrl": "http://localhost:9093/api/"
- }
-}
diff --git a/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient.sln b/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient.sln
deleted file mode 100644
index b524ff54400..00000000000
--- a/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient.sln
+++ /dev/null
@@ -1,31 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.30907.101
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Altinn.EFormidlingClient", "Altinn.EFormidlingClient\Altinn.EFormidlingClient.csproj", "{3EE9F578-0CB0-4884-9A68-DF50D1957FE1}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Altinn.EFormidlingClient.Tests", "Altinn.EFormidlingClient.Tests\Altinn.EFormidlingClient.Tests.csproj", "{090C4A90-4E9F-4FBF-AD9D-891CD9BDFD96}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {3EE9F578-0CB0-4884-9A68-DF50D1957FE1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {3EE9F578-0CB0-4884-9A68-DF50D1957FE1}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {3EE9F578-0CB0-4884-9A68-DF50D1957FE1}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {3EE9F578-0CB0-4884-9A68-DF50D1957FE1}.Release|Any CPU.Build.0 = Release|Any CPU
- {090C4A90-4E9F-4FBF-AD9D-891CD9BDFD96}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {090C4A90-4E9F-4FBF-AD9D-891CD9BDFD96}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {090C4A90-4E9F-4FBF-AD9D-891CD9BDFD96}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {090C4A90-4E9F-4FBF-AD9D-891CD9BDFD96}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {4E6BC023-0117-4D4B-8448-6E69F99312C2}
- EndGlobalSection
-EndGlobal
diff --git a/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient/Altinn.EFormidlingClient.csproj b/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient/Altinn.EFormidlingClient.csproj
deleted file mode 100644
index f31f6a8ba2a..00000000000
--- a/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient/Altinn.EFormidlingClient.csproj
+++ /dev/null
@@ -1,54 +0,0 @@
-
-
-
- netstandard2.0
- Library
- 1.3.3.0
- 1.3.3.0
- Altinn.Common.EFormidlingClient
- Altinn;Studio;eFormidling;client
-
- Altinn.Common.EFormidlingClient is a package for sending messages via eFormidling to receiver.
-
-
- Altinn Platform Contributors
- git
- https://github.com/Altinn/altinn-studio
- true
- snupkg
- true
-
-
- {790c4782-cdb0-4c06-8e16-514cb617b8e0}
-
-
-
-
-
-
-
-
-
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
- stylecop.json
-
-
-
-
-
-
-
-
- ..\Altinn3.ruleset
-
-
-
- 1701;1702;1587
- bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml
-
-
-
diff --git a/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient/Configuration/EFormidlingClientSettings.cs b/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient/Configuration/EFormidlingClientSettings.cs
deleted file mode 100644
index 685da73bb13..00000000000
--- a/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient/Configuration/EFormidlingClientSettings.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-namespace Altinn.Common.EFormidlingClient.Configuration
-{
- ///
- /// Settings for EFormidling Client
- ///
- public class EFormidlingClientSettings
- {
- ///
- /// BaseUrl for eFormidling integration point API
- ///
- public string BaseUrl { get; set; }
- }
-}
diff --git a/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient/EFormidlingClient.cs b/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient/EFormidlingClient.cs
deleted file mode 100644
index 041b4ffa462..00000000000
--- a/src/Altinn.Common/Altinn.EFormidlingClient/Altinn.EFormidlingClient/EFormidlingClient.cs
+++ /dev/null
@@ -1,383 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Net;
-using System.Net.Http;
-using System.Net.Http.Headers;
-using System.Text;
-using System.Text.Json;
-using System.Threading.Tasks;
-using System.Web;
-
-using Altinn.Common.EFormidlingClient.Configuration;
-using Altinn.Common.EFormidlingClient.Models;
-using Altinn.Common.EFormidlingClient.Models.SBD;
-using Altinn.EFormidlingClient.Extensions;
-using Altinn.EFormidlingClient.Models;
-
-using Microsoft.Extensions.Logging;
-using Microsoft.Extensions.Options;
-
-namespace Altinn.Common.EFormidlingClient
-{
- ///
- /// Represents an implementation of using a HttpClient.
- ///
- public class EFormidlingClient : IEFormidlingClient
- {
- private readonly HttpClient _client;
- private readonly ILogger _logger;
- private readonly EFormidlingClientSettings _eformidlingSettings;
-
- ///
- /// Initializes a new instance of the IFormidlingClient class with the given HttpClient, lSettings and Logger.
- ///
- /// A HttpClient provided by a HttpClientFactory.
- /// The settings configured for eFormidling package
- /// Logging
- public EFormidlingClient(
- HttpClient httpClient,
- IOptions eformidlingSettings,
- ILogger logger)
- {
- _client = httpClient ?? throw new ArgumentNullException("httpClient");
- _eformidlingSettings = eformidlingSettings?.Value ?? throw new ArgumentNullException("eformidlingSettings");
- _logger = logger ?? throw new ArgumentNullException("logger");
-
- _client.DefaultRequestHeaders.Clear();
- _client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
- _client.BaseAddress = new Uri(_eformidlingSettings.BaseUrl);
- }
-
- ///
- public async Task SendMessage(string id, Dictionary requestHeaders)
- {
- if (string.IsNullOrEmpty(id))
- {
- throw new ArgumentNullException(nameof(id));
- }
-
- string responseBody = null;
- try
- {
- HttpResponseMessage res = await _client.PostAsync($"messages/out/{id}", null, requestHeaders);
- responseBody = await res.Content.ReadAsStringAsync();
- res.EnsureSuccessStatusCode();
- }
- catch (HttpRequestException)
- {
- throw new WebException($"The remote server returned an unexpcted error: {responseBody}.");
- }
- catch (Exception ex)
- {
- _logger.LogError("Message :{Exception} ", ex);
- throw;
- }
- }
-
- ///
- public async Task FindOutGoingMessages(string serviceIdentifier, Dictionary requestHeaders)
- {
- string responseBody;
-
- AssertNotNullOrEmpty(serviceIdentifier, nameof(serviceIdentifier));
-
- try
- {
- HttpResponseMessage response = await _client.GetAsync($"messages/out/?serviceIdentifier={serviceIdentifier}", requestHeaders);
- responseBody = await response.Content.ReadAsStringAsync();
- _logger.LogDebug(responseBody);
- }
- catch (HttpRequestException e)
- {
- _logger.LogError("Message :{Exception} ", e.Message);
- throw;
- }
- }
-
- ///
- public async Task GetAllMessageStatuses(Dictionary requestHeaders)
- {
- string responseBody;
- try
- {
- HttpResponseMessage response = await _client.GetAsync($"statuses", requestHeaders);
- responseBody = await response.Content.ReadAsStringAsync();
- Statuses allMessageStatuses = JsonSerializer.Deserialize(responseBody);
- _logger.LogDebug(responseBody);
-
- return allMessageStatuses;
- }
- catch (HttpRequestException e)
- {
- _logger.LogError("Message :{Exception} ", e.Message);
- throw;
- }
- }
-
- ///
- public async Task GetCapabilities(string orgId, Dictionary