From bac012f9b43f7363f4f4413de5f3f7e3aa1adb21 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Tue, 7 May 2019 12:54:39 +0200 Subject: [PATCH] accessrights.jdl: UserRoleAssignments entity*Id required --- .jhipster/Asset.json | 2 +- .jhipster/Customer.json | 2 +- .jhipster/Membership.json | 2 +- .jhipster/SepaMandate.json | 2 +- .jhipster/Share.json | 2 +- .jhipster/UserRoleAssignment.json | 14 +++-- actually-used-JHipster-workflow.txt | 31 ----------- build.gradle | 2 - .../hsadminng/domain/UserRoleAssignment.java | 7 ++- src/main/jdl/accessrights.jdl | 4 +- ... 20190507105332_added_entity_Customer.xml} | 2 +- ...0190507105333_added_entity_Membership.xml} | 2 +- ...3_added_entity_constraints_Membership.xml} | 2 +- ... => 20190507105334_added_entity_Share.xml} | 2 +- ...105334_added_entity_constraints_Share.xml} | 2 +- ... => 20190507105335_added_entity_Asset.xml} | 2 +- ...105335_added_entity_constraints_Asset.xml} | 2 +- ...190507105336_added_entity_SepaMandate.xml} | 2 +- ..._added_entity_constraints_SepaMandate.xml} | 2 +- ...05342_added_entity_UserRoleAssignment.xml} | 8 +-- ...entity_constraints_UserRoleAssignment.xml} | 2 +- .../resources/config/liquibase/master.xml | 22 ++++---- ...user-role-assignment-update.component.html | 24 ++++++++- src/main/webapp/i18n/de/global.json | 6 ++- src/main/webapp/i18n/en/global.json | 6 ++- .../web/rest/CustomerResourceIntTest.java | 4 +- .../UserRoleAssignmentResourceIntTest.java | 38 +++++++++++++ .../asset/asset-update.component.spec.ts | 54 ++++++++++--------- .../customer-update.component.spec.ts | 54 ++++++++++--------- .../membership-update.component.spec.ts | 54 ++++++++++--------- .../sepa-mandate-update.component.spec.ts | 54 ++++++++++--------- .../share/share-update.component.spec.ts | 54 ++++++++++--------- ...r-role-assignment-update.component.spec.ts | 54 ++++++++++--------- 33 files changed, 298 insertions(+), 222 deletions(-) delete mode 100644 actually-used-JHipster-workflow.txt rename src/main/resources/config/liquibase/changelog/{20190430152136_added_entity_Customer.xml => 20190507105332_added_entity_Customer.xml} (98%) rename src/main/resources/config/liquibase/changelog/{20190430152137_added_entity_Membership.xml => 20190507105333_added_entity_Membership.xml} (97%) rename src/main/resources/config/liquibase/changelog/{20190430152137_added_entity_constraints_Membership.xml => 20190507105333_added_entity_constraints_Membership.xml} (93%) rename src/main/resources/config/liquibase/changelog/{20190430152138_added_entity_Share.xml => 20190507105334_added_entity_Share.xml} (97%) rename src/main/resources/config/liquibase/changelog/{20190430152138_added_entity_constraints_Share.xml => 20190507105334_added_entity_constraints_Share.xml} (92%) rename src/main/resources/config/liquibase/changelog/{20190430152139_added_entity_Asset.xml => 20190507105335_added_entity_Asset.xml} (97%) rename src/main/resources/config/liquibase/changelog/{20190430152139_added_entity_constraints_Asset.xml => 20190507105335_added_entity_constraints_Asset.xml} (92%) rename src/main/resources/config/liquibase/changelog/{20190430152140_added_entity_SepaMandate.xml => 20190507105336_added_entity_SepaMandate.xml} (97%) rename src/main/resources/config/liquibase/changelog/{20190430152140_added_entity_constraints_SepaMandate.xml => 20190507105336_added_entity_constraints_SepaMandate.xml} (93%) rename src/main/resources/config/liquibase/changelog/{20190430154711_added_entity_UserRoleAssignment.xml => 20190507105342_added_entity_UserRoleAssignment.xml} (88%) rename src/main/resources/config/liquibase/changelog/{20190430154711_added_entity_constraints_UserRoleAssignment.xml => 20190507105342_added_entity_constraints_UserRoleAssignment.xml} (93%) diff --git a/.jhipster/Asset.json b/.jhipster/Asset.json index 1cbaef36..ff8816aa 100644 --- a/.jhipster/Asset.json +++ b/.jhipster/Asset.json @@ -49,7 +49,7 @@ "otherEntityField": "admissionDocumentDate" } ], - "changelogDate": "20190430154657", + "changelogDate": "20190507105335", "entityTableName": "asset", "dto": "mapstruct", "pagination": "infinite-scroll", diff --git a/.jhipster/Customer.json b/.jhipster/Customer.json index d3b3f02e..97a58c7e 100644 --- a/.jhipster/Customer.json +++ b/.jhipster/Customer.json @@ -142,7 +142,7 @@ "relationshipName": "sepamandate" } ], - "changelogDate": "20190430154654", + "changelogDate": "20190507105332", "entityTableName": "customer", "dto": "mapstruct", "pagination": "infinite-scroll", diff --git a/.jhipster/Membership.json b/.jhipster/Membership.json index 5f320cec..90797b5b 100644 --- a/.jhipster/Membership.json +++ b/.jhipster/Membership.json @@ -54,7 +54,7 @@ "otherEntityField": "prefix" } ], - "changelogDate": "20190430154655", + "changelogDate": "20190507105333", "entityTableName": "membership", "dto": "mapstruct", "pagination": "infinite-scroll", diff --git a/.jhipster/SepaMandate.json b/.jhipster/SepaMandate.json index 1a46bf84..5879f6ed 100644 --- a/.jhipster/SepaMandate.json +++ b/.jhipster/SepaMandate.json @@ -72,7 +72,7 @@ "otherEntityField": "prefix" } ], - "changelogDate": "20190430154658", + "changelogDate": "20190507105336", "entityTableName": "sepa_mandate", "dto": "mapstruct", "pagination": "infinite-scroll", diff --git a/.jhipster/Share.json b/.jhipster/Share.json index ad783fbe..206438bd 100644 --- a/.jhipster/Share.json +++ b/.jhipster/Share.json @@ -49,7 +49,7 @@ "otherEntityField": "admissionDocumentDate" } ], - "changelogDate": "20190430154656", + "changelogDate": "20190507105334", "entityTableName": "share", "dto": "mapstruct", "pagination": "infinite-scroll", diff --git a/.jhipster/UserRoleAssignment.json b/.jhipster/UserRoleAssignment.json index 81427c6a..493221c3 100644 --- a/.jhipster/UserRoleAssignment.json +++ b/.jhipster/UserRoleAssignment.json @@ -3,11 +3,19 @@ "fields": [ { "fieldName": "entityTypeId", - "fieldType": "String" + "fieldType": "String", + "fieldValidateRules": [ + "required", + "maxlength" + ], + "fieldValidateRulesMaxlength": 32 }, { "fieldName": "entityObjectId", - "fieldType": "Long" + "fieldType": "Long", + "fieldValidateRules": [ + "required" + ] }, { "fieldName": "assignedRole", @@ -27,7 +35,7 @@ "otherEntityField": "login" } ], - "changelogDate": "20190430154711", + "changelogDate": "20190507105342", "entityTableName": "user_role_assignment", "dto": "no", "pagination": "infinite-scroll", diff --git a/actually-used-JHipster-workflow.txt b/actually-used-JHipster-workflow.txt deleted file mode 100644 index 908f3555..00000000 --- a/actually-used-JHipster-workflow.txt +++ /dev/null @@ -1,31 +0,0 @@ - - git checkout jhipster-generated - git pull - git tag REAL-HEAD - git reset --hard jdl-base - git clean -f -d - git cherry-pick -n spotless - git reset --soft REAL-HEAD - git checkout REAL-HEAD src/main/jdl/customer.jdl # AND OTHERS! - git tag -d REAL-HEAD - - # MANUAL STEP: Apply changes to the jdl file! - - # (Re-) Importing - jhipster import-jdl src/main/jdl/customer.jdl - jhipster import-jdl src/main/jdl/accessrights.jdl - # AND OTHERS! - - # add @formatter:off to src/main/java/org/hostsharing/hsadminng/config/SecurityConfiguration.java - # I will add this change to the commit with the spotless commit to get rid of this. - - gw spotlessApply - git add . - git commit -m"..." - - # MANUAL STEP: - # - if you've renamed any identifiers, use refactoring to rename in master as well BEFORE MERGING! - - # Merge changeset into master branch - git checkout master - git merge jhipster-generated diff --git a/build.gradle b/build.gradle index f9ed10f9..4a550182 100644 --- a/build.gradle +++ b/build.gradle @@ -32,8 +32,6 @@ plugins { apply plugin: 'java' sourceCompatibility=1.8 targetCompatibility=1.8 -// Until JHipster supports JDK 9 -assert System.properties['java.specification.version'] == '1.8' apply plugin: 'maven' apply plugin: 'org.springframework.boot' diff --git a/src/main/java/org/hostsharing/hsadminng/domain/UserRoleAssignment.java b/src/main/java/org/hostsharing/hsadminng/domain/UserRoleAssignment.java index 8073f6d5..e2021eeb 100644 --- a/src/main/java/org/hostsharing/hsadminng/domain/UserRoleAssignment.java +++ b/src/main/java/org/hostsharing/hsadminng/domain/UserRoleAssignment.java @@ -25,10 +25,13 @@ public class UserRoleAssignment implements Serializable { @SequenceGenerator(name = "sequenceGenerator") private Long id; - @Column(name = "entity_type_id") + @NotNull + @Size(max = 32) + @Column(name = "entity_type_id", length = 32, nullable = false) private String entityTypeId; - @Column(name = "entity_object_id") + @NotNull + @Column(name = "entity_object_id", nullable = false) private Long entityObjectId; @NotNull diff --git a/src/main/jdl/accessrights.jdl b/src/main/jdl/accessrights.jdl index fe1f18ad..cd640ce1 100644 --- a/src/main/jdl/accessrights.jdl +++ b/src/main/jdl/accessrights.jdl @@ -12,8 +12,8 @@ enum UserRole { } entity UserRoleAssignment { - entityTypeId String, - entityObjectId Long, + entityTypeId String required maxlength(32), + entityObjectId Long required, assignedRole UserRole required } diff --git a/src/main/resources/config/liquibase/changelog/20190430152136_added_entity_Customer.xml b/src/main/resources/config/liquibase/changelog/20190507105332_added_entity_Customer.xml similarity index 98% rename from src/main/resources/config/liquibase/changelog/20190430152136_added_entity_Customer.xml rename to src/main/resources/config/liquibase/changelog/20190507105332_added_entity_Customer.xml index 7229b27d..a11f49ac 100644 --- a/src/main/resources/config/liquibase/changelog/20190430152136_added_entity_Customer.xml +++ b/src/main/resources/config/liquibase/changelog/20190507105332_added_entity_Customer.xml @@ -16,7 +16,7 @@ - + diff --git a/src/main/resources/config/liquibase/changelog/20190430152137_added_entity_Membership.xml b/src/main/resources/config/liquibase/changelog/20190507105333_added_entity_Membership.xml similarity index 97% rename from src/main/resources/config/liquibase/changelog/20190430152137_added_entity_Membership.xml rename to src/main/resources/config/liquibase/changelog/20190507105333_added_entity_Membership.xml index a272e70d..3bb20ecf 100644 --- a/src/main/resources/config/liquibase/changelog/20190430152137_added_entity_Membership.xml +++ b/src/main/resources/config/liquibase/changelog/20190507105333_added_entity_Membership.xml @@ -16,7 +16,7 @@ - + diff --git a/src/main/resources/config/liquibase/changelog/20190430152137_added_entity_constraints_Membership.xml b/src/main/resources/config/liquibase/changelog/20190507105333_added_entity_constraints_Membership.xml similarity index 93% rename from src/main/resources/config/liquibase/changelog/20190430152137_added_entity_constraints_Membership.xml rename to src/main/resources/config/liquibase/changelog/20190507105333_added_entity_constraints_Membership.xml index b298dc4f..aa5bb247 100644 --- a/src/main/resources/config/liquibase/changelog/20190430152137_added_entity_constraints_Membership.xml +++ b/src/main/resources/config/liquibase/changelog/20190507105333_added_entity_constraints_Membership.xml @@ -6,7 +6,7 @@ - + - + diff --git a/src/main/resources/config/liquibase/changelog/20190430152138_added_entity_constraints_Share.xml b/src/main/resources/config/liquibase/changelog/20190507105334_added_entity_constraints_Share.xml similarity index 92% rename from src/main/resources/config/liquibase/changelog/20190430152138_added_entity_constraints_Share.xml rename to src/main/resources/config/liquibase/changelog/20190507105334_added_entity_constraints_Share.xml index 625dc8b7..ccfe0ddc 100644 --- a/src/main/resources/config/liquibase/changelog/20190430152138_added_entity_constraints_Share.xml +++ b/src/main/resources/config/liquibase/changelog/20190507105334_added_entity_constraints_Share.xml @@ -6,7 +6,7 @@ - + - + diff --git a/src/main/resources/config/liquibase/changelog/20190430152139_added_entity_constraints_Asset.xml b/src/main/resources/config/liquibase/changelog/20190507105335_added_entity_constraints_Asset.xml similarity index 92% rename from src/main/resources/config/liquibase/changelog/20190430152139_added_entity_constraints_Asset.xml rename to src/main/resources/config/liquibase/changelog/20190507105335_added_entity_constraints_Asset.xml index 79006896..2da4503b 100644 --- a/src/main/resources/config/liquibase/changelog/20190430152139_added_entity_constraints_Asset.xml +++ b/src/main/resources/config/liquibase/changelog/20190507105335_added_entity_constraints_Asset.xml @@ -6,7 +6,7 @@ - + - + diff --git a/src/main/resources/config/liquibase/changelog/20190430152140_added_entity_constraints_SepaMandate.xml b/src/main/resources/config/liquibase/changelog/20190507105336_added_entity_constraints_SepaMandate.xml similarity index 93% rename from src/main/resources/config/liquibase/changelog/20190430152140_added_entity_constraints_SepaMandate.xml rename to src/main/resources/config/liquibase/changelog/20190507105336_added_entity_constraints_SepaMandate.xml index 958ab70e..3975b2bc 100644 --- a/src/main/resources/config/liquibase/changelog/20190430152140_added_entity_constraints_SepaMandate.xml +++ b/src/main/resources/config/liquibase/changelog/20190507105336_added_entity_constraints_SepaMandate.xml @@ -6,7 +6,7 @@ - + - + - - + + - + diff --git a/src/main/resources/config/liquibase/changelog/20190430154711_added_entity_constraints_UserRoleAssignment.xml b/src/main/resources/config/liquibase/changelog/20190507105342_added_entity_constraints_UserRoleAssignment.xml similarity index 93% rename from src/main/resources/config/liquibase/changelog/20190430154711_added_entity_constraints_UserRoleAssignment.xml rename to src/main/resources/config/liquibase/changelog/20190507105342_added_entity_constraints_UserRoleAssignment.xml index bf09debe..1b8a1d14 100644 --- a/src/main/resources/config/liquibase/changelog/20190430154711_added_entity_constraints_UserRoleAssignment.xml +++ b/src/main/resources/config/liquibase/changelog/20190507105342_added_entity_constraints_UserRoleAssignment.xml @@ -6,7 +6,7 @@ - + - - - - - - + + + + + + - - - - - + + + + + diff --git a/src/main/webapp/app/entities/user-role-assignment/user-role-assignment-update.component.html b/src/main/webapp/app/entities/user-role-assignment/user-role-assignment-update.component.html index c8e3b023..f6f3965d 100644 --- a/src/main/webapp/app/entities/user-role-assignment/user-role-assignment-update.component.html +++ b/src/main/webapp/app/entities/user-role-assignment/user-role-assignment-update.component.html @@ -12,12 +12,32 @@
+ [(ngModel)]="userRoleAssignment.entityTypeId" required maxlength="32"/> +
+ + This field is required. + + + This field cannot be longer than 32 characters. + +
+ [(ngModel)]="userRoleAssignment.entityObjectId" required/> +
+ + This field is required. + + + This field should be a number. + +
diff --git a/src/main/webapp/i18n/de/global.json b/src/main/webapp/i18n/de/global.json index e698b745..6d210dd5 100644 --- a/src/main/webapp/i18n/de/global.json +++ b/src/main/webapp/i18n/de/global.json @@ -1,7 +1,8 @@ { "global": { "title": "HsadminNg", - "browsehappy": "Sie benutzen einen veralteten Browser. Bitte aktualisieren Sie Ihren Browser, um die Benutzerfreundlichkeit zu erhöhen.", + "browsehappy": + "Sie benutzen einen veralteten Browser. Bitte aktualisieren Sie Ihren Browser, um die Benutzerfreundlichkeit zu erhöhen.", "menu": { "home": "Startseite", "jhipster-needle-menu-add-element": "JHipster will add additional menu entries here (do not translate!)", @@ -56,7 +57,8 @@ "authenticated": { "prefix": "Wenn Sie sich ", "link": "anmelden", - "suffix": " möchten, versuchen Sie es mit
- Administrator (Name=\"admin\" und Passwort=\"admin\")
- Benutzer (Name=\"user\" und Passwort=\"user\")." + "suffix": + " möchten, versuchen Sie es mit
- Administrator (Name=\"admin\" und Passwort=\"admin\")
- Benutzer (Name=\"user\" und Passwort=\"user\")." }, "register": { "noaccount": "Sie haben noch keinen Zugang?", diff --git a/src/main/webapp/i18n/en/global.json b/src/main/webapp/i18n/en/global.json index 03bbc5d7..4ccbaacb 100644 --- a/src/main/webapp/i18n/en/global.json +++ b/src/main/webapp/i18n/en/global.json @@ -1,7 +1,8 @@ { "global": { "title": "HsadminNg", - "browsehappy": "You are using an outdated browser. Please upgrade your browser to improve your experience.", + "browsehappy": + "You are using an outdated browser. Please upgrade your browser to improve your experience.", "menu": { "home": "Home", "jhipster-needle-menu-add-element": "JHipster will add additional menu entries here (do not translate!)", @@ -56,7 +57,8 @@ "authenticated": { "prefix": "If you want to ", "link": "sign in", - "suffix": ", you can try the default accounts:
- Administrator (login=\"admin\" and password=\"admin\")
- User (login=\"user\" and password=\"user\")." + "suffix": + ", you can try the default accounts:
- Administrator (login=\"admin\" and password=\"admin\")
- User (login=\"user\" and password=\"user\")." }, "register": { "noaccount": "You don't have an account yet?", diff --git a/src/test/java/org/hostsharing/hsadminng/web/rest/CustomerResourceIntTest.java b/src/test/java/org/hostsharing/hsadminng/web/rest/CustomerResourceIntTest.java index f939f27a..44fca57a 100644 --- a/src/test/java/org/hostsharing/hsadminng/web/rest/CustomerResourceIntTest.java +++ b/src/test/java/org/hostsharing/hsadminng/web/rest/CustomerResourceIntTest.java @@ -53,8 +53,8 @@ public class CustomerResourceIntTest { private static final Integer DEFAULT_REFERENCE = 10000; private static final Integer UPDATED_REFERENCE = 10001; - private static final String DEFAULT_PREFIX = "z4a"; - private static final String UPDATED_PREFIX = "dr"; + private static final String DEFAULT_PREFIX = "y5j"; + private static final String UPDATED_PREFIX = "f0u"; private static final String DEFAULT_NAME = "AAAAAAAAAA"; private static final String UPDATED_NAME = "BBBBBBBBBB"; diff --git a/src/test/java/org/hostsharing/hsadminng/web/rest/UserRoleAssignmentResourceIntTest.java b/src/test/java/org/hostsharing/hsadminng/web/rest/UserRoleAssignmentResourceIntTest.java index 411c375f..12dd6d84 100644 --- a/src/test/java/org/hostsharing/hsadminng/web/rest/UserRoleAssignmentResourceIntTest.java +++ b/src/test/java/org/hostsharing/hsadminng/web/rest/UserRoleAssignmentResourceIntTest.java @@ -156,6 +156,44 @@ public class UserRoleAssignmentResourceIntTest { assertThat(userRoleAssignmentList).hasSize(databaseSizeBeforeCreate); } + @Test + @Transactional + public void checkEntityTypeIdIsRequired() throws Exception { + int databaseSizeBeforeTest = userRoleAssignmentRepository.findAll().size(); + // set the field null + userRoleAssignment.setEntityTypeId(null); + + // Create the UserRoleAssignment, which fails. + + restUserRoleAssignmentMockMvc.perform( + post("/api/user-role-assignments") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(userRoleAssignment))) + .andExpect(status().isBadRequest()); + + List userRoleAssignmentList = userRoleAssignmentRepository.findAll(); + assertThat(userRoleAssignmentList).hasSize(databaseSizeBeforeTest); + } + + @Test + @Transactional + public void checkEntityObjectIdIsRequired() throws Exception { + int databaseSizeBeforeTest = userRoleAssignmentRepository.findAll().size(); + // set the field null + userRoleAssignment.setEntityObjectId(null); + + // Create the UserRoleAssignment, which fails. + + restUserRoleAssignmentMockMvc.perform( + post("/api/user-role-assignments") + .contentType(TestUtil.APPLICATION_JSON_UTF8) + .content(TestUtil.convertObjectToJsonBytes(userRoleAssignment))) + .andExpect(status().isBadRequest()); + + List userRoleAssignmentList = userRoleAssignmentRepository.findAll(); + assertThat(userRoleAssignmentList).hasSize(databaseSizeBeforeTest); + } + @Test @Transactional public void checkAssignedRoleIsRequired() throws Exception { diff --git a/src/test/javascript/spec/app/entities/asset/asset-update.component.spec.ts b/src/test/javascript/spec/app/entities/asset/asset-update.component.spec.ts index 20bcdf53..271d60c9 100644 --- a/src/test/javascript/spec/app/entities/asset/asset-update.component.spec.ts +++ b/src/test/javascript/spec/app/entities/asset/asset-update.component.spec.ts @@ -28,33 +28,39 @@ describe('Component Tests', () => { }); describe('save', () => { - it('Should call update service on save for existing entity', fakeAsync(() => { - // GIVEN - const entity = new Asset(123); - spyOn(service, 'update').and.returnValue(of(new HttpResponse({ body: entity }))); - comp.asset = entity; - // WHEN - comp.save(); - tick(); // simulate async + it( + 'Should call update service on save for existing entity', + fakeAsync(() => { + // GIVEN + const entity = new Asset(123); + spyOn(service, 'update').and.returnValue(of(new HttpResponse({ body: entity }))); + comp.asset = entity; + // WHEN + comp.save(); + tick(); // simulate async - // THEN - expect(service.update).toHaveBeenCalledWith(entity); - expect(comp.isSaving).toEqual(false); - })); + // THEN + expect(service.update).toHaveBeenCalledWith(entity); + expect(comp.isSaving).toEqual(false); + }) + ); - it('Should call create service on save for new entity', fakeAsync(() => { - // GIVEN - const entity = new Asset(); - spyOn(service, 'create').and.returnValue(of(new HttpResponse({ body: entity }))); - comp.asset = entity; - // WHEN - comp.save(); - tick(); // simulate async + it( + 'Should call create service on save for new entity', + fakeAsync(() => { + // GIVEN + const entity = new Asset(); + spyOn(service, 'create').and.returnValue(of(new HttpResponse({ body: entity }))); + comp.asset = entity; + // WHEN + comp.save(); + tick(); // simulate async - // THEN - expect(service.create).toHaveBeenCalledWith(entity); - expect(comp.isSaving).toEqual(false); - })); + // THEN + expect(service.create).toHaveBeenCalledWith(entity); + expect(comp.isSaving).toEqual(false); + }) + ); }); }); }); diff --git a/src/test/javascript/spec/app/entities/customer/customer-update.component.spec.ts b/src/test/javascript/spec/app/entities/customer/customer-update.component.spec.ts index e50a46df..c0c60a27 100644 --- a/src/test/javascript/spec/app/entities/customer/customer-update.component.spec.ts +++ b/src/test/javascript/spec/app/entities/customer/customer-update.component.spec.ts @@ -28,33 +28,39 @@ describe('Component Tests', () => { }); describe('save', () => { - it('Should call update service on save for existing entity', fakeAsync(() => { - // GIVEN - const entity = new Customer(123); - spyOn(service, 'update').and.returnValue(of(new HttpResponse({ body: entity }))); - comp.customer = entity; - // WHEN - comp.save(); - tick(); // simulate async + it( + 'Should call update service on save for existing entity', + fakeAsync(() => { + // GIVEN + const entity = new Customer(123); + spyOn(service, 'update').and.returnValue(of(new HttpResponse({ body: entity }))); + comp.customer = entity; + // WHEN + comp.save(); + tick(); // simulate async - // THEN - expect(service.update).toHaveBeenCalledWith(entity); - expect(comp.isSaving).toEqual(false); - })); + // THEN + expect(service.update).toHaveBeenCalledWith(entity); + expect(comp.isSaving).toEqual(false); + }) + ); - it('Should call create service on save for new entity', fakeAsync(() => { - // GIVEN - const entity = new Customer(); - spyOn(service, 'create').and.returnValue(of(new HttpResponse({ body: entity }))); - comp.customer = entity; - // WHEN - comp.save(); - tick(); // simulate async + it( + 'Should call create service on save for new entity', + fakeAsync(() => { + // GIVEN + const entity = new Customer(); + spyOn(service, 'create').and.returnValue(of(new HttpResponse({ body: entity }))); + comp.customer = entity; + // WHEN + comp.save(); + tick(); // simulate async - // THEN - expect(service.create).toHaveBeenCalledWith(entity); - expect(comp.isSaving).toEqual(false); - })); + // THEN + expect(service.create).toHaveBeenCalledWith(entity); + expect(comp.isSaving).toEqual(false); + }) + ); }); }); }); diff --git a/src/test/javascript/spec/app/entities/membership/membership-update.component.spec.ts b/src/test/javascript/spec/app/entities/membership/membership-update.component.spec.ts index abd5a5a2..6f08b14e 100644 --- a/src/test/javascript/spec/app/entities/membership/membership-update.component.spec.ts +++ b/src/test/javascript/spec/app/entities/membership/membership-update.component.spec.ts @@ -28,33 +28,39 @@ describe('Component Tests', () => { }); describe('save', () => { - it('Should call update service on save for existing entity', fakeAsync(() => { - // GIVEN - const entity = new Membership(123); - spyOn(service, 'update').and.returnValue(of(new HttpResponse({ body: entity }))); - comp.membership = entity; - // WHEN - comp.save(); - tick(); // simulate async + it( + 'Should call update service on save for existing entity', + fakeAsync(() => { + // GIVEN + const entity = new Membership(123); + spyOn(service, 'update').and.returnValue(of(new HttpResponse({ body: entity }))); + comp.membership = entity; + // WHEN + comp.save(); + tick(); // simulate async - // THEN - expect(service.update).toHaveBeenCalledWith(entity); - expect(comp.isSaving).toEqual(false); - })); + // THEN + expect(service.update).toHaveBeenCalledWith(entity); + expect(comp.isSaving).toEqual(false); + }) + ); - it('Should call create service on save for new entity', fakeAsync(() => { - // GIVEN - const entity = new Membership(); - spyOn(service, 'create').and.returnValue(of(new HttpResponse({ body: entity }))); - comp.membership = entity; - // WHEN - comp.save(); - tick(); // simulate async + it( + 'Should call create service on save for new entity', + fakeAsync(() => { + // GIVEN + const entity = new Membership(); + spyOn(service, 'create').and.returnValue(of(new HttpResponse({ body: entity }))); + comp.membership = entity; + // WHEN + comp.save(); + tick(); // simulate async - // THEN - expect(service.create).toHaveBeenCalledWith(entity); - expect(comp.isSaving).toEqual(false); - })); + // THEN + expect(service.create).toHaveBeenCalledWith(entity); + expect(comp.isSaving).toEqual(false); + }) + ); }); }); }); diff --git a/src/test/javascript/spec/app/entities/sepa-mandate/sepa-mandate-update.component.spec.ts b/src/test/javascript/spec/app/entities/sepa-mandate/sepa-mandate-update.component.spec.ts index c2246524..ccb3c179 100644 --- a/src/test/javascript/spec/app/entities/sepa-mandate/sepa-mandate-update.component.spec.ts +++ b/src/test/javascript/spec/app/entities/sepa-mandate/sepa-mandate-update.component.spec.ts @@ -28,33 +28,39 @@ describe('Component Tests', () => { }); describe('save', () => { - it('Should call update service on save for existing entity', fakeAsync(() => { - // GIVEN - const entity = new SepaMandate(123); - spyOn(service, 'update').and.returnValue(of(new HttpResponse({ body: entity }))); - comp.sepaMandate = entity; - // WHEN - comp.save(); - tick(); // simulate async + it( + 'Should call update service on save for existing entity', + fakeAsync(() => { + // GIVEN + const entity = new SepaMandate(123); + spyOn(service, 'update').and.returnValue(of(new HttpResponse({ body: entity }))); + comp.sepaMandate = entity; + // WHEN + comp.save(); + tick(); // simulate async - // THEN - expect(service.update).toHaveBeenCalledWith(entity); - expect(comp.isSaving).toEqual(false); - })); + // THEN + expect(service.update).toHaveBeenCalledWith(entity); + expect(comp.isSaving).toEqual(false); + }) + ); - it('Should call create service on save for new entity', fakeAsync(() => { - // GIVEN - const entity = new SepaMandate(); - spyOn(service, 'create').and.returnValue(of(new HttpResponse({ body: entity }))); - comp.sepaMandate = entity; - // WHEN - comp.save(); - tick(); // simulate async + it( + 'Should call create service on save for new entity', + fakeAsync(() => { + // GIVEN + const entity = new SepaMandate(); + spyOn(service, 'create').and.returnValue(of(new HttpResponse({ body: entity }))); + comp.sepaMandate = entity; + // WHEN + comp.save(); + tick(); // simulate async - // THEN - expect(service.create).toHaveBeenCalledWith(entity); - expect(comp.isSaving).toEqual(false); - })); + // THEN + expect(service.create).toHaveBeenCalledWith(entity); + expect(comp.isSaving).toEqual(false); + }) + ); }); }); }); diff --git a/src/test/javascript/spec/app/entities/share/share-update.component.spec.ts b/src/test/javascript/spec/app/entities/share/share-update.component.spec.ts index 279be464..f1d86461 100644 --- a/src/test/javascript/spec/app/entities/share/share-update.component.spec.ts +++ b/src/test/javascript/spec/app/entities/share/share-update.component.spec.ts @@ -28,33 +28,39 @@ describe('Component Tests', () => { }); describe('save', () => { - it('Should call update service on save for existing entity', fakeAsync(() => { - // GIVEN - const entity = new Share(123); - spyOn(service, 'update').and.returnValue(of(new HttpResponse({ body: entity }))); - comp.share = entity; - // WHEN - comp.save(); - tick(); // simulate async + it( + 'Should call update service on save for existing entity', + fakeAsync(() => { + // GIVEN + const entity = new Share(123); + spyOn(service, 'update').and.returnValue(of(new HttpResponse({ body: entity }))); + comp.share = entity; + // WHEN + comp.save(); + tick(); // simulate async - // THEN - expect(service.update).toHaveBeenCalledWith(entity); - expect(comp.isSaving).toEqual(false); - })); + // THEN + expect(service.update).toHaveBeenCalledWith(entity); + expect(comp.isSaving).toEqual(false); + }) + ); - it('Should call create service on save for new entity', fakeAsync(() => { - // GIVEN - const entity = new Share(); - spyOn(service, 'create').and.returnValue(of(new HttpResponse({ body: entity }))); - comp.share = entity; - // WHEN - comp.save(); - tick(); // simulate async + it( + 'Should call create service on save for new entity', + fakeAsync(() => { + // GIVEN + const entity = new Share(); + spyOn(service, 'create').and.returnValue(of(new HttpResponse({ body: entity }))); + comp.share = entity; + // WHEN + comp.save(); + tick(); // simulate async - // THEN - expect(service.create).toHaveBeenCalledWith(entity); - expect(comp.isSaving).toEqual(false); - })); + // THEN + expect(service.create).toHaveBeenCalledWith(entity); + expect(comp.isSaving).toEqual(false); + }) + ); }); }); }); diff --git a/src/test/javascript/spec/app/entities/user-role-assignment/user-role-assignment-update.component.spec.ts b/src/test/javascript/spec/app/entities/user-role-assignment/user-role-assignment-update.component.spec.ts index 0ca89214..bfe2210f 100644 --- a/src/test/javascript/spec/app/entities/user-role-assignment/user-role-assignment-update.component.spec.ts +++ b/src/test/javascript/spec/app/entities/user-role-assignment/user-role-assignment-update.component.spec.ts @@ -28,33 +28,39 @@ describe('Component Tests', () => { }); describe('save', () => { - it('Should call update service on save for existing entity', fakeAsync(() => { - // GIVEN - const entity = new UserRoleAssignment(123); - spyOn(service, 'update').and.returnValue(of(new HttpResponse({ body: entity }))); - comp.userRoleAssignment = entity; - // WHEN - comp.save(); - tick(); // simulate async + it( + 'Should call update service on save for existing entity', + fakeAsync(() => { + // GIVEN + const entity = new UserRoleAssignment(123); + spyOn(service, 'update').and.returnValue(of(new HttpResponse({ body: entity }))); + comp.userRoleAssignment = entity; + // WHEN + comp.save(); + tick(); // simulate async - // THEN - expect(service.update).toHaveBeenCalledWith(entity); - expect(comp.isSaving).toEqual(false); - })); + // THEN + expect(service.update).toHaveBeenCalledWith(entity); + expect(comp.isSaving).toEqual(false); + }) + ); - it('Should call create service on save for new entity', fakeAsync(() => { - // GIVEN - const entity = new UserRoleAssignment(); - spyOn(service, 'create').and.returnValue(of(new HttpResponse({ body: entity }))); - comp.userRoleAssignment = entity; - // WHEN - comp.save(); - tick(); // simulate async + it( + 'Should call create service on save for new entity', + fakeAsync(() => { + // GIVEN + const entity = new UserRoleAssignment(); + spyOn(service, 'create').and.returnValue(of(new HttpResponse({ body: entity }))); + comp.userRoleAssignment = entity; + // WHEN + comp.save(); + tick(); // simulate async - // THEN - expect(service.create).toHaveBeenCalledWith(entity); - expect(comp.isSaving).toEqual(false); - })); + // THEN + expect(service.create).toHaveBeenCalledWith(entity); + expect(comp.isSaving).toEqual(false); + }) + ); }); }); });