From 78bad4ea0c93e6a1eaccc76635e54f8c585cde97 Mon Sep 17 00:00:00 2001 From: John Martin <48291409+jomartin-999@users.noreply.github.com> Date: Wed, 2 Nov 2022 17:02:42 -0400 Subject: [PATCH 1/3] Updated the Spring and gradle versions --- session-state/README.md | 2 +- session-state/build.gradle | 8 ++++---- session-state/gradle/wrapper/gradle-wrapper.properties | 2 +- session-state/src/main/resources/application.properties | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/session-state/README.md b/session-state/README.md index 23659c9..76f4ba2 100644 --- a/session-state/README.md +++ b/session-state/README.md @@ -5,7 +5,7 @@ SPDX-License-Identifier: Apache-2.0 # Session State Code Example -This example demonstrates the use of Tanzu GemFire for session state caching and can be used with the [Session State Caching Guide](https://tanzu.vmware.com/developer/data/tanzu-gemfire/guides/session-state-cache-sbdg/). +This example demonstrates the use of VMware GemFire for session state caching and can be used with the [Session State Caching Guide](https://tanzu.vmware.com/developer/data/tanzu-gemfire/guides/session-state-cache-sbdg/). The application uses [Spring Boot for Apache Geode](https://docs.spring.io/autorepo/docs/spring-boot-data-geode-build/current/reference/html5/). diff --git a/session-state/build.gradle b/session-state/build.gradle index a98eb76..20377e4 100644 --- a/session-state/build.gradle +++ b/session-state/build.gradle @@ -4,13 +4,13 @@ SPDX-License-Identifier: Apache-2.0 */ plugins { - id 'org.springframework.boot' version '2.4.1' - id 'io.spring.dependency-management' version '1.0.10.RELEASE' + id 'org.springframework.boot' version '2.7.5' + id 'io.spring.dependency-management' version '1.0.15.RELEASE' id 'java' id("com.github.node-gradle.node") version "2.2.4" } -group = 'com.vmware.tanzu.gemfire.session-state-example' +group = 'com.vmware.gemfire.session-state-example' version = '0.0.1-SNAPSHOT' sourceCompatibility = '1.8' @@ -31,7 +31,7 @@ repositories { } ext { - set('springGeodeVersion', "1.4.0") + set('springGeodeVersion', "1.7.5") } dependencies { diff --git a/session-state/gradle/wrapper/gradle-wrapper.properties b/session-state/gradle/wrapper/gradle-wrapper.properties index 8d58bda..b1159fc 100644 --- a/session-state/gradle/wrapper/gradle-wrapper.properties +++ b/session-state/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/session-state/src/main/resources/application.properties b/session-state/src/main/resources/application.properties index 52338d8..3622b59 100644 --- a/session-state/src/main/resources/application.properties +++ b/session-state/src/main/resources/application.properties @@ -3,7 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 # -#Properties used to connect to Tanzu GemFire for Kubernetes +#Properties used to connect to VMware GemFire for Kubernetes #spring.data.gemfire.pool.locators: notes-app-cluster-locator-0.notes-app-cluster-locator.tanzu-gemfire[10334] #spring.data.gemfire.management.http.host: notes-app-cluster-locator-0.notes-app-cluster-locator.tanzu-gemfire From c314be7f625e9f1b53f41886c85a2ccbfbbe6b65 Mon Sep 17 00:00:00 2001 From: John Martin <48291409+jomartin-999@users.noreply.github.com> Date: Thu, 3 Nov 2022 17:30:04 -0400 Subject: [PATCH 2/3] Updated to Spring for GemFire. Removed frontend tests --- session-state/README.md | 4 +- session-state/build.gradle | 30 ++--- session-state/frontend/cypress.json | 9 -- .../frontend/cypress/e2e/App.spec.js | 108 ------------------ .../frontend/cypress/fixtures/example.json | 5 - session-state/frontend/jest.config.js | 16 --- session-state/frontend/package.json | 37 ++---- session-state/frontend/src/index.js | 5 +- session-state/frontend/src/styles/fonts.css | 13 ++- .../frontend/test/App.Integration.test.js | 90 --------------- .../frontend/test/NotesDisplay.test.js | 41 ------- session-state/frontend/test/NotesForm.test.js | 43 ------- .../frontend/test/SessionService.test.js | 39 ------- .../frontend/test/__mocks__/axios.js | 10 -- .../frontend/test/__mocks__/styleMock.js | 1 - .../frontend/test/config/setUpTests.js | 9 -- session-state/gradle.properties | 2 + .../sessionstate/SessionControllerTest.java | 3 +- 18 files changed, 38 insertions(+), 427 deletions(-) delete mode 100644 session-state/frontend/cypress.json delete mode 100644 session-state/frontend/cypress/e2e/App.spec.js delete mode 100644 session-state/frontend/cypress/fixtures/example.json delete mode 100644 session-state/frontend/jest.config.js delete mode 100644 session-state/frontend/test/App.Integration.test.js delete mode 100644 session-state/frontend/test/NotesDisplay.test.js delete mode 100644 session-state/frontend/test/NotesForm.test.js delete mode 100644 session-state/frontend/test/SessionService.test.js delete mode 100644 session-state/frontend/test/__mocks__/axios.js delete mode 100644 session-state/frontend/test/__mocks__/styleMock.js delete mode 100644 session-state/frontend/test/config/setUpTests.js create mode 100644 session-state/gradle.properties diff --git a/session-state/README.md b/session-state/README.md index 76f4ba2..043bcdb 100644 --- a/session-state/README.md +++ b/session-state/README.md @@ -5,9 +5,7 @@ SPDX-License-Identifier: Apache-2.0 # Session State Code Example -This example demonstrates the use of VMware GemFire for session state caching and can be used with the [Session State Caching Guide](https://tanzu.vmware.com/developer/data/tanzu-gemfire/guides/session-state-cache-sbdg/). - -The application uses [Spring Boot for Apache Geode](https://docs.spring.io/autorepo/docs/spring-boot-data-geode-build/current/reference/html5/). +This example demonstrates the use of VMware GemFire for session state caching. ## When should I use a session state cache? diff --git a/session-state/build.gradle b/session-state/build.gradle index 20377e4..fe2ff04 100644 --- a/session-state/build.gradle +++ b/session-state/build.gradle @@ -28,16 +28,20 @@ bootBuildImage{ repositories { mavenCentral() + maven { + credentials { + username "$gemfireRepoUsername" + password "$gemfireRepoPassword" + } + url = uri("https://commercial-repo.pivotal.io/data3/gemfire-release-repo/gemfire") + } } -ext { - set('springGeodeVersion', "1.7.5") -} dependencies { - implementation 'org.springframework.geode:spring-geode-starter' - implementation 'org.springframework.geode:spring-geode-starter-session' implementation 'org.springframework.boot:spring-boot-starter-web' + implementation "com.vmware.gemfire:spring-gemfire-starter-9.15:2.7.0" + implementation "com.vmware.gemfire:spring-gemfire-starter-session-9.15:2.7.0" testImplementation 'org.springframework.boot:spring-boot-starter-test' @@ -51,9 +55,6 @@ dependencyManagement { entry('log4j-to-slf4j') } } - imports { - mavenBom "org.springframework.geode:spring-geode-bom:${springGeodeVersion}" - } } test { @@ -63,8 +64,8 @@ test { node { - version = '14.15.4' - npmVersion = '6.14.10' + version = '18.12.0' + npmVersion = '8.19.2' download = true // Set the work directory for unpacking node @@ -72,6 +73,7 @@ node { // Set the work directory for NPM npmWorkDir = file("build/node") + // Set the work directory for Yarn yarnWorkDir = file("build/yarn") } @@ -93,16 +95,8 @@ task copyFrontEnd(type: Copy) { into 'build/resources/main/static/' } -task appYarnTest(type: YarnTask) { - description = "Builds production version of the frontend" - workingDir = file("frontend") - args = ["run", "test"] -} - appYarnBuild.dependsOn appYarnInstall copyFrontEnd.dependsOn appYarnBuild processResources.dependsOn copyFrontEnd -appYarnTest.dependsOn appYarnInstall -test.dependsOn appYarnTest diff --git a/session-state/frontend/cypress.json b/session-state/frontend/cypress.json deleted file mode 100644 index 2ba973f..0000000 --- a/session-state/frontend/cypress.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "baseUrl": "http://localhost:8080", - "integrationFolder": "cypress/e2e", - "pluginsFile": false, - "supportFile": false, - "video": false -} - - diff --git a/session-state/frontend/cypress/e2e/App.spec.js b/session-state/frontend/cypress/e2e/App.spec.js deleted file mode 100644 index f32fea5..0000000 --- a/session-state/frontend/cypress/e2e/App.spec.js +++ /dev/null @@ -1,108 +0,0 @@ -/* -Copyright 2019 - 2021 VMware, Inc. -SPDX-License-Identifier: Apache-2.0 -*/ - - -context('App', () => { - beforeEach(() => { - cy.visit('/'); - }); - - describe('When user adds a note ', () => { - before(() => { - cy.server(); - cy.route({ - method: 'POST', - url: '/addSessionNote', - }).as('addSessionNoteRouteAlias'); - cy.route({ - method: 'POST', - url: '/invalidateSession', - }).as('invalidateSessionRouteAlias'); - }); - - it('should display note in note list', () => { - cy.get('[data-qa="NotesForm__note-input"]').type("a test note"); - cy.get('[data-qa="NotesForm__submit-button"]').click(); - cy.wait('@addSessionNoteRouteAlias'); - - cy.get('[data-qa="NotesDisplay__note"]') - .should((notes) => { - expect(notes).to.have.length(1); - expect(notes[0]).to.contain("a test note") - }); - }); - - after(() => { - cy.get('[data-qa="NotesDisplay__destroy-session-button"]').click(); - cy.wait('@invalidateSessionRouteAlias'); - }); - }); - - - describe('When page is reloaded', () => { - before(() => { - cy.server(); - cy.route({ - method: 'POST', - url: '/addSessionNote', - }).as('addSessionNoteRouteAlias'); - cy.route({ - method: 'POST', - url: '/invalidateSession', - }).as('invalidateSessionRouteAlias'); - cy.get('[data-qa="NotesForm__note-input"]').type("note to be saved in the session"); - cy.get('[data-qa="NotesForm__submit-button"]').click(); - cy.wait('@addSessionNoteRouteAlias'); - }); - - it('should display all notes previously added in session', () => { - cy.reload(); - - cy.get('[data-qa="NotesDisplay__note"]') - .should((notes) => { - expect(notes).to.have.length(1); - expect(notes[0]).to.contain("note to be saved in the session") - }); - }); - - after(() => { - cy.get('[data-qa="NotesDisplay__destroy-session-button"]').click(); - cy.wait('@invalidateSessionRouteAlias'); - }); - }); - - describe('When user destroys the session', () => { - before(() => { - cy.server(); - cy.route({ - method: 'POST', - url: '/addSessionNote', - }).as('addSessionNoteRouteAlias'); - cy.route({ - method: 'POST', - url: '/invalidateSession', - }).as('invalidateSessionRouteAlias'); - cy.get('[data-qa="NotesForm__note-input"]').type("note to be destroyed"); - cy.get('[data-qa="NotesForm__submit-button"]').click(); - cy.wait('@addSessionNoteRouteAlias'); - }); - - it('should no longer display any notes', () => { - cy.get('[data-qa="NotesDisplay__note"]') - .should((notes) => { - expect(notes).to.have.length(1); - }); - - cy.get('[data-qa="NotesDisplay__destroy-session-button"]').click(); - cy.wait('@invalidateSessionRouteAlias'); - - cy.get('[data-qa="NotesDisplay__note"]') - .should((notes) => { - expect(notes).to.have.length(0); - }); - }); - }); -}); - diff --git a/session-state/frontend/cypress/fixtures/example.json b/session-state/frontend/cypress/fixtures/example.json deleted file mode 100644 index da18d93..0000000 --- a/session-state/frontend/cypress/fixtures/example.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "Using fixtures to represent data", - "email": "hello@cypress.io", - "body": "Fixtures are a great way to mock data for responses to routes" -} \ No newline at end of file diff --git a/session-state/frontend/jest.config.js b/session-state/frontend/jest.config.js deleted file mode 100644 index 6616203..0000000 --- a/session-state/frontend/jest.config.js +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright 2019 - 2021 VMware, Inc. - * SPDX-License-Identifier: Apache-2.0 - */ - -module.exports = { - "transform": { - "^.+\\.(js|jsx)$": "/node_modules/babel-jest" - }, - "moduleNameMapper": { - "\\.(css|jpg|png|svg)$": "/test/__mocks__/styleMock.js" - }, - "testMatch": ["/test/**/?(*.)+(spec|test).js?(x)" ], - "setupFilesAfterEnv": ["/test/config/setUpTests.js"], - "clearMocks": true -}; \ No newline at end of file diff --git a/session-state/frontend/package.json b/session-state/frontend/package.json index 222712c..e285160 100644 --- a/session-state/frontend/package.json +++ b/session-state/frontend/package.json @@ -3,29 +3,21 @@ "version": "0.1.0", "private": true, "dependencies": { - "@testing-library/jest-dom": "^5.1.0", - "@testing-library/react": "^10.0.1", - "@testing-library/user-event": "^10.0.0", - "acorn": "7.1.1", - "axios": ">=0.21.1", + "acorn": "^8.8.1", + "axios": "^1.1.3", "enzyme": "^3.11.0", - "enzyme-adapter-react-16": "^1.15.2", - "minimist": "1.2.6", - "react": "^16.13.1", - "react-dom": "^16.13.1", - "react-scripts": "^3.4.4", - "serialize-javascript": "^3.0.0" - }, - "resolutions": { - "minimist": "1.2.5", - "acorn": "7.1.1", - "@babel/preset-env": "^7.8.7" + "enzyme-adapter-react-16": "^1.15.6", + "minimist": "^1.2.7", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "react-scripts": "^5.0.1", + "serialize-javascript": "^6.0.0" }, + "scripts": { "start": "react-scripts start", - "build": "react-scripts build", - "test": "jest", - "eject": "react-scripts eject" + "build": "react-scripts build" + }, "eslintConfig": { "extends": "react-app" @@ -41,12 +33,5 @@ "last 1 firefox version", "last 1 safari version" ] - }, - "devDependencies": { - "@babel/plugin-proposal-class-properties": "^7.8.3", - "@babel/plugin-transform-runtime": "^7.8.3", - "babel-jest": "^24.9.0", - "cypress": "^4.2.0", - "react-test-renderer": "^16.13.1" } } diff --git a/session-state/frontend/src/index.js b/session-state/frontend/src/index.js index c86877a..25f4aec 100644 --- a/session-state/frontend/src/index.js +++ b/session-state/frontend/src/index.js @@ -4,7 +4,8 @@ */ import React from 'react'; -import ReactDOM from 'react-dom'; +import {createRoot} from 'react-dom/client'; import App from './components/App'; +const root = createRoot(document.getElementById("root")); -ReactDOM.render(, document.getElementById('root')); \ No newline at end of file +root.render(, document.getElementById('root')); \ No newline at end of file diff --git a/session-state/frontend/src/styles/fonts.css b/session-state/frontend/src/styles/fonts.css index 37cb43b..86a4088 100755 --- a/session-state/frontend/src/styles/fonts.css +++ b/session-state/frontend/src/styles/fonts.css @@ -5,24 +5,25 @@ @font-face { font-family: 'proxima_nova_reg'; - src: url('/resources/fonts/proxima_nova_reg/proximanova-reg.woff2') format('woff2'), - url('/resources/fonts/proxima_nova_reg/proximanova-reg.woff') format('woff'); + src: local("proxima_nova_reg-reg"), url('./../../public/resources/fonts/proxima_nova_reg/proximanova-reg.woff2') format('woff2'), + url('./../../public/resources/fonts/proxima_nova_reg/proximanova-reg.woff') format('woff'); font-weight: normal; font-style: normal; } + @font-face { font-family: 'proxima_nova_bold'; - src: url('/resources/fonts/proxima_nova_bold/proximanova-bold.woff2') format('woff2'), - url('/resources/fonts/proxima_nova_bold/proximanova-bold.woff') format('woff'); + src: local("proxima_nova_bold"), url('./../../public/resources/fonts/proxima_nova_bold/proximanova-bold.woff2') format('woff2'), + url('./../../public/resources/fonts/proxima_nova_bold/proximanova-bold.woff') format('woff'); font-weight: bold; font-style: normal; } @font-face { font-family: 'proxima_nova_semibold'; - src: url('/resources/fonts/proxima_nova_semibold/proximanova-semibold.woff2') format('woff2'), - url('/resources/fonts/proxima_nova_semibold/proximanova-semibold.woff') format('woff'); + src: local("proxima_nova_semibold"), url('./../../public/resources/fonts/proxima_nova_semibold/proximanova-semibold.woff2') format('woff2'), + url('./../../public/resources/fonts/proxima_nova_semibold/proximanova-semibold.woff') format('woff'); font-weight: 600; font-style: normal; } \ No newline at end of file diff --git a/session-state/frontend/test/App.Integration.test.js b/session-state/frontend/test/App.Integration.test.js deleted file mode 100644 index 391bfd3..0000000 --- a/session-state/frontend/test/App.Integration.test.js +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2019 - 2021 VMware, Inc. - * SPDX-License-Identifier: Apache-2.0 - */ - -import React from 'react'; -import {mount} from 'enzyme'; -import sessionService from "../src/sessionService"; -import App from "../src/components/App"; - -describe("App Integration", () => { - let subject; - - it('should get and update notes after mounting', async () => { - const getNotesPromise = Promise.resolve(["One note", "Two note"]); - const getNotesSpy = jest.spyOn(sessionService, 'getNotes').mockImplementation(() => getNotesPromise); - - subject = mount( - - ); - - await getNotesPromise; - subject.update(); - const notes = subject.find('[data-qa="NotesDisplay__note"]'); - - expect(notes.length).toEqual(2); - expect(notes.at(1).text()).toEqual("Two note"); - expect(getNotesSpy).toHaveBeenCalledTimes(1); - }); - - describe('when destroy session button clicked', function () { - - let destroySessionSpy; - let destroySessionPromise; - let getNotesSpyPromiseWithNotes; - let getNotesSpyPromiseWithoutNotes; - let getNotesSpy; - - beforeEach(async () => { - destroySessionSpy = jest.spyOn(sessionService, 'destroySession'); - destroySessionPromise = Promise.resolve({}); - getNotesSpyPromiseWithNotes = Promise.resolve(["One note", "Two note"]); - getNotesSpyPromiseWithoutNotes = Promise.resolve([]); - - getNotesSpy = jest.spyOn(sessionService, 'getNotes'); - - destroySessionSpy.mockImplementationOnce(() => destroySessionPromise); - - getNotesSpy - .mockImplementationOnce(() => getNotesSpyPromiseWithNotes) - .mockImplementationOnce(() => getNotesSpyPromiseWithoutNotes); - - subject = mount( - - ); - - await getNotesSpyPromiseWithNotes; - subject.update(); - }); - - it('should clear session when "Destroy Session" button is clicked', async () => { - subject.find('[data-qa="NotesDisplay__destroy-session-button"]').simulate('click'); - - await destroySessionPromise; - await getNotesSpyPromiseWithoutNotes; - subject.update(); - - expect(destroySessionSpy).toHaveBeenCalledTimes(1); - }); - - it('should delete notes when "Destroy Session" button is clicked', async () => { - - let notes = subject.find('[data-qa="NotesDisplay__note"]'); - - expect(notes.length).toEqual(2); - expect(getNotesSpy).toHaveBeenCalledTimes(1); - - subject.find('[data-qa="NotesDisplay__destroy-session-button"]').simulate('click'); - - await destroySessionPromise; - await getNotesSpyPromiseWithoutNotes; - subject.update(); - - notes = subject.find('[data-qa="NotesDisplay__note"]'); - - expect(notes.length).toEqual(0); - expect(getNotesSpy).toHaveBeenCalledTimes(2); - }); - }); -}); \ No newline at end of file diff --git a/session-state/frontend/test/NotesDisplay.test.js b/session-state/frontend/test/NotesDisplay.test.js deleted file mode 100644 index 5b5df25..0000000 --- a/session-state/frontend/test/NotesDisplay.test.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2019 - 2021 VMware, Inc. - * SPDX-License-Identifier: Apache-2.0 - */ - -import React from 'react'; -import {mount} from 'enzyme'; -import NotesDisplay from "../src/components/NotesDisplay"; -import sessionService from "../src/sessionService"; - -describe("NotesDisplay", () => { - let subject; - - beforeEach(() => { - subject = mount( - {}}/> - ); - }); - - it('should not display any notes or notes header if no notes exist', () => { - subject.setProps({notes: []}); - - expect(subject.find('[data-qa="NotesDisplay__header"]').exists()).toBeFalsy(); - }); - - it('should correctly display notes if notes exist', () => { - const notes = subject.find('[data-qa="NotesDisplay__note"]'); - - expect(notes.length).toEqual(4); - expect(notes.at(0).text()).toEqual("One note"); - expect(subject.find('[data-qa="NotesDisplay__header"]').exists()).toBeTruthy(); - }); - - it('should destroy session when "Destroy Session" button clicked', () => { - const destroySessionSpy = jest.spyOn(sessionService, 'destroySession'); - - subject.find('[data-qa="NotesDisplay__destroy-session-button"]').simulate('click'); - - expect(destroySessionSpy).toHaveBeenCalledTimes(1); - }); -}); diff --git a/session-state/frontend/test/NotesForm.test.js b/session-state/frontend/test/NotesForm.test.js deleted file mode 100644 index b9f0688..0000000 --- a/session-state/frontend/test/NotesForm.test.js +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2019 - 2021 VMware, Inc. - * SPDX-License-Identifier: Apache-2.0 - */ - -import React from 'react'; -import {mount} from 'enzyme'; -import NotesForm from "../src/components/NotesForm"; -import sessionService from "../src/sessionService"; - -describe("NotesForm", () => { - let subject; - const mockGetNotes = jest.fn(); - - beforeEach(() => { - subject = mount( - - ); - }); - - it('should capture note correctly when input text changes', () => { - expect(subject.state().note).toEqual(''); - - const noteInput = subject.find('[data-qa="NotesForm__note-input"]'); - noteInput.instance().value = 'New note!'; - noteInput.simulate('change'); - - expect(subject.state().note).toEqual('New note!'); - }); - - it('should add inputted note when form is submitted', () => { - - const addNoteSpy = jest.spyOn(sessionService, 'addNote'); - const noteInput = subject.find('[data-qa="NotesForm__note-input"]'); - - noteInput.instance().value = 'New note!'; - noteInput.simulate('change'); - subject.find('[data-qa="NotesForm__submit-button"]').simulate('submit'); - - expect(addNoteSpy).toHaveBeenCalledTimes(1); - expect(addNoteSpy).toHaveBeenCalledWith('New note!'); - }); -}); \ No newline at end of file diff --git a/session-state/frontend/test/SessionService.test.js b/session-state/frontend/test/SessionService.test.js deleted file mode 100644 index 126bc91..0000000 --- a/session-state/frontend/test/SessionService.test.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2019 - 2021 VMware, Inc. - * SPDX-License-Identifier: Apache-2.0 - */ - -import sessionService from "../src/sessionService"; -import mockAxios from 'axios' - - -describe("sessionService", () => { - it('should call addSessionNote endpoint when addNote is called', async () => { - mockAxios.post.mockImplementationOnce(() => - Promise.resolve({ data: {} }), - ); - await sessionService.addNote("New note!"); - - expect(mockAxios.post).toHaveBeenCalledTimes(1); - expect(mockAxios.post).toHaveBeenCalledWith("/addSessionNote", 'New note!', {"headers": {"Content-Type": "text/plain"}}); - }); - - it('should call getSessionNotes endpoint when getNotes is called', async () => { - mockAxios.get.mockImplementationOnce(() => - Promise.resolve({ data: ["One note", "Two note"] }), - ); - await sessionService.getNotes(); - expect(mockAxios.get).toHaveBeenCalledTimes(1); - expect(mockAxios.get).toHaveBeenCalledWith("/getSessionNotes"); - }); - - it('should call invalidateSession endpoint when destroySession is called', async () => { - mockAxios.post.mockImplementationOnce(() => - Promise.resolve({ data: {} }), - ); - await sessionService.destroySession(); - - expect(mockAxios.post).toHaveBeenCalledTimes(1); - expect(mockAxios.post).toHaveBeenCalledWith("/invalidateSession"); - }); -}); \ No newline at end of file diff --git a/session-state/frontend/test/__mocks__/axios.js b/session-state/frontend/test/__mocks__/axios.js deleted file mode 100644 index a64f100..0000000 --- a/session-state/frontend/test/__mocks__/axios.js +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright 2019 - 2021 VMware, Inc. - * SPDX-License-Identifier: Apache-2.0 - */ - -const mockAxios = jest.genMockFromModule('axios'); - -mockAxios.create = jest.fn(() => mockAxios); - -export default mockAxios; \ No newline at end of file diff --git a/session-state/frontend/test/__mocks__/styleMock.js b/session-state/frontend/test/__mocks__/styleMock.js deleted file mode 100644 index a099545..0000000 --- a/session-state/frontend/test/__mocks__/styleMock.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = {}; \ No newline at end of file diff --git a/session-state/frontend/test/config/setUpTests.js b/session-state/frontend/test/config/setUpTests.js deleted file mode 100644 index 6ca1269..0000000 --- a/session-state/frontend/test/config/setUpTests.js +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright 2019 - 2021 VMware, Inc. - * SPDX-License-Identifier: Apache-2.0 - */ - -import { configure } from 'enzyme'; -import Adapter from 'enzyme-adapter-react-16'; - -configure({ adapter: new Adapter() }); \ No newline at end of file diff --git a/session-state/gradle.properties b/session-state/gradle.properties new file mode 100644 index 0000000..712cbc8 --- /dev/null +++ b/session-state/gradle.properties @@ -0,0 +1,2 @@ +gemfireRepoUsername=YOUR_PIVOTAL_COMMERCIAL_MAVEN_REPO_USERNAME +gemfireRepoPassword=YOUR_PIVOTAL_COMMERCIAL_MAVEN_REPO_PASSWORD \ No newline at end of file diff --git a/session-state/src/test/java/sessionstate/SessionControllerTest.java b/session-state/src/test/java/sessionstate/SessionControllerTest.java index bed53cb..55c5585 100644 --- a/session-state/src/test/java/sessionstate/SessionControllerTest.java +++ b/session-state/src/test/java/sessionstate/SessionControllerTest.java @@ -3,7 +3,8 @@ SPDX-License-Identifier: Apache-2.0 */ -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; From 831718c8af3621a551ac6829ecf564bc4d3d17e8 Mon Sep 17 00:00:00 2001 From: John Martin <48291409+jomartin-999@users.noreply.github.com> Date: Thu, 10 Nov 2022 09:51:09 -0500 Subject: [PATCH 3/3] Updated build.gradle to new artifact names. --- session-state/build.gradle | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/session-state/build.gradle b/session-state/build.gradle index fe2ff04..7ee1a26 100644 --- a/session-state/build.gradle +++ b/session-state/build.gradle @@ -40,9 +40,8 @@ repositories { dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' - implementation "com.vmware.gemfire:spring-gemfire-starter-9.15:2.7.0" - implementation "com.vmware.gemfire:spring-gemfire-starter-session-9.15:2.7.0" - + implementation "com.vmware.gemfire:spring-boot-2.7-gemfire-9.15:1.0.0" + implementation "com.vmware.gemfire:spring-boot-session-2.7-gemfire-9.15:1.0.0" testImplementation 'org.springframework.boot:spring-boot-starter-test' }