accessrights.jdl: UserRoleAssignments entity*Id required

This commit is contained in:
Michael Hoennig 2019-05-07 12:54:39 +02:00
parent 6df2cbce0b
commit bac012f9b4
33 changed files with 298 additions and 222 deletions

View File

@ -49,7 +49,7 @@
"otherEntityField": "admissionDocumentDate" "otherEntityField": "admissionDocumentDate"
} }
], ],
"changelogDate": "20190430154657", "changelogDate": "20190507105335",
"entityTableName": "asset", "entityTableName": "asset",
"dto": "mapstruct", "dto": "mapstruct",
"pagination": "infinite-scroll", "pagination": "infinite-scroll",

View File

@ -142,7 +142,7 @@
"relationshipName": "sepamandate" "relationshipName": "sepamandate"
} }
], ],
"changelogDate": "20190430154654", "changelogDate": "20190507105332",
"entityTableName": "customer", "entityTableName": "customer",
"dto": "mapstruct", "dto": "mapstruct",
"pagination": "infinite-scroll", "pagination": "infinite-scroll",

View File

@ -54,7 +54,7 @@
"otherEntityField": "prefix" "otherEntityField": "prefix"
} }
], ],
"changelogDate": "20190430154655", "changelogDate": "20190507105333",
"entityTableName": "membership", "entityTableName": "membership",
"dto": "mapstruct", "dto": "mapstruct",
"pagination": "infinite-scroll", "pagination": "infinite-scroll",

View File

@ -72,7 +72,7 @@
"otherEntityField": "prefix" "otherEntityField": "prefix"
} }
], ],
"changelogDate": "20190430154658", "changelogDate": "20190507105336",
"entityTableName": "sepa_mandate", "entityTableName": "sepa_mandate",
"dto": "mapstruct", "dto": "mapstruct",
"pagination": "infinite-scroll", "pagination": "infinite-scroll",

View File

@ -49,7 +49,7 @@
"otherEntityField": "admissionDocumentDate" "otherEntityField": "admissionDocumentDate"
} }
], ],
"changelogDate": "20190430154656", "changelogDate": "20190507105334",
"entityTableName": "share", "entityTableName": "share",
"dto": "mapstruct", "dto": "mapstruct",
"pagination": "infinite-scroll", "pagination": "infinite-scroll",

View File

@ -3,11 +3,19 @@
"fields": [ "fields": [
{ {
"fieldName": "entityTypeId", "fieldName": "entityTypeId",
"fieldType": "String" "fieldType": "String",
"fieldValidateRules": [
"required",
"maxlength"
],
"fieldValidateRulesMaxlength": 32
}, },
{ {
"fieldName": "entityObjectId", "fieldName": "entityObjectId",
"fieldType": "Long" "fieldType": "Long",
"fieldValidateRules": [
"required"
]
}, },
{ {
"fieldName": "assignedRole", "fieldName": "assignedRole",
@ -27,7 +35,7 @@
"otherEntityField": "login" "otherEntityField": "login"
} }
], ],
"changelogDate": "20190430154711", "changelogDate": "20190507105342",
"entityTableName": "user_role_assignment", "entityTableName": "user_role_assignment",
"dto": "no", "dto": "no",
"pagination": "infinite-scroll", "pagination": "infinite-scroll",

View File

@ -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

View File

@ -32,8 +32,6 @@ plugins {
apply plugin: 'java' apply plugin: 'java'
sourceCompatibility=1.8 sourceCompatibility=1.8
targetCompatibility=1.8 targetCompatibility=1.8
// Until JHipster supports JDK 9
assert System.properties['java.specification.version'] == '1.8'
apply plugin: 'maven' apply plugin: 'maven'
apply plugin: 'org.springframework.boot' apply plugin: 'org.springframework.boot'

View File

@ -25,10 +25,13 @@ public class UserRoleAssignment implements Serializable {
@SequenceGenerator(name = "sequenceGenerator") @SequenceGenerator(name = "sequenceGenerator")
private Long id; private Long id;
@Column(name = "entity_type_id") @NotNull
@Size(max = 32)
@Column(name = "entity_type_id", length = 32, nullable = false)
private String entityTypeId; private String entityTypeId;
@Column(name = "entity_object_id") @NotNull
@Column(name = "entity_object_id", nullable = false)
private Long entityObjectId; private Long entityObjectId;
@NotNull @NotNull

View File

@ -12,8 +12,8 @@ enum UserRole {
} }
entity UserRoleAssignment { entity UserRoleAssignment {
entityTypeId String, entityTypeId String required maxlength(32),
entityObjectId Long, entityObjectId Long required,
assignedRole UserRole required assignedRole UserRole required
} }

View File

@ -16,7 +16,7 @@
<!-- <!--
Added the entity Customer. Added the entity Customer.
--> -->
<changeSet id="20190430152136-1" author="jhipster"> <changeSet id="20190507105332-1" author="jhipster">
<createTable tableName="customer"> <createTable tableName="customer">
<column name="id" type="bigint" autoIncrement="${autoIncrement}"> <column name="id" type="bigint" autoIncrement="${autoIncrement}">
<constraints primaryKey="true" nullable="false"/> <constraints primaryKey="true" nullable="false"/>

View File

@ -16,7 +16,7 @@
<!-- <!--
Added the entity Membership. Added the entity Membership.
--> -->
<changeSet id="20190430152137-1" author="jhipster"> <changeSet id="20190507105333-1" author="jhipster">
<createTable tableName="membership"> <createTable tableName="membership">
<column name="id" type="bigint" autoIncrement="${autoIncrement}"> <column name="id" type="bigint" autoIncrement="${autoIncrement}">
<constraints primaryKey="true" nullable="false"/> <constraints primaryKey="true" nullable="false"/>

View File

@ -6,7 +6,7 @@
<!-- <!--
Added the constraints for entity Membership. Added the constraints for entity Membership.
--> -->
<changeSet id="20190430152137-2" author="jhipster"> <changeSet id="20190507105333-2" author="jhipster">
<addForeignKeyConstraint baseColumnNames="customer_id" <addForeignKeyConstraint baseColumnNames="customer_id"
baseTableName="membership" baseTableName="membership"

View File

@ -16,7 +16,7 @@
<!-- <!--
Added the entity Share. Added the entity Share.
--> -->
<changeSet id="20190430152138-1" author="jhipster"> <changeSet id="20190507105334-1" author="jhipster">
<createTable tableName="share"> <createTable tableName="share">
<column name="id" type="bigint" autoIncrement="${autoIncrement}"> <column name="id" type="bigint" autoIncrement="${autoIncrement}">
<constraints primaryKey="true" nullable="false"/> <constraints primaryKey="true" nullable="false"/>

View File

@ -6,7 +6,7 @@
<!-- <!--
Added the constraints for entity Share. Added the constraints for entity Share.
--> -->
<changeSet id="20190430152138-2" author="jhipster"> <changeSet id="20190507105334-2" author="jhipster">
<addForeignKeyConstraint baseColumnNames="membership_id" <addForeignKeyConstraint baseColumnNames="membership_id"
baseTableName="share" baseTableName="share"

View File

@ -16,7 +16,7 @@
<!-- <!--
Added the entity Asset. Added the entity Asset.
--> -->
<changeSet id="20190430152139-1" author="jhipster"> <changeSet id="20190507105335-1" author="jhipster">
<createTable tableName="asset"> <createTable tableName="asset">
<column name="id" type="bigint" autoIncrement="${autoIncrement}"> <column name="id" type="bigint" autoIncrement="${autoIncrement}">
<constraints primaryKey="true" nullable="false"/> <constraints primaryKey="true" nullable="false"/>

View File

@ -6,7 +6,7 @@
<!-- <!--
Added the constraints for entity Asset. Added the constraints for entity Asset.
--> -->
<changeSet id="20190430152139-2" author="jhipster"> <changeSet id="20190507105335-2" author="jhipster">
<addForeignKeyConstraint baseColumnNames="membership_id" <addForeignKeyConstraint baseColumnNames="membership_id"
baseTableName="asset" baseTableName="asset"

View File

@ -16,7 +16,7 @@
<!-- <!--
Added the entity SepaMandate. Added the entity SepaMandate.
--> -->
<changeSet id="20190430152140-1" author="jhipster"> <changeSet id="20190507105336-1" author="jhipster">
<createTable tableName="sepa_mandate"> <createTable tableName="sepa_mandate">
<column name="id" type="bigint" autoIncrement="${autoIncrement}"> <column name="id" type="bigint" autoIncrement="${autoIncrement}">
<constraints primaryKey="true" nullable="false"/> <constraints primaryKey="true" nullable="false"/>

View File

@ -6,7 +6,7 @@
<!-- <!--
Added the constraints for entity SepaMandate. Added the constraints for entity SepaMandate.
--> -->
<changeSet id="20190430152140-2" author="jhipster"> <changeSet id="20190507105336-2" author="jhipster">
<addForeignKeyConstraint baseColumnNames="customer_id" <addForeignKeyConstraint baseColumnNames="customer_id"
baseTableName="sepa_mandate" baseTableName="sepa_mandate"

View File

@ -16,17 +16,17 @@
<!-- <!--
Added the entity UserRoleAssignment. Added the entity UserRoleAssignment.
--> -->
<changeSet id="20190430154711-1" author="jhipster"> <changeSet id="20190507105342-1" author="jhipster">
<createTable tableName="user_role_assignment"> <createTable tableName="user_role_assignment">
<column name="id" type="bigint" autoIncrement="${autoIncrement}"> <column name="id" type="bigint" autoIncrement="${autoIncrement}">
<constraints primaryKey="true" nullable="false"/> <constraints primaryKey="true" nullable="false"/>
</column> </column>
<column name="entity_type_id" type="varchar(255)"> <column name="entity_type_id" type="varchar(32)">
<constraints nullable="true" /> <constraints nullable="false" />
</column> </column>
<column name="entity_object_id" type="bigint"> <column name="entity_object_id" type="bigint">
<constraints nullable="true" /> <constraints nullable="false" />
</column> </column>
<column name="assigned_role" type="varchar(255)"> <column name="assigned_role" type="varchar(255)">

View File

@ -6,7 +6,7 @@
<!-- <!--
Added the constraints for entity UserRoleAssignment. Added the constraints for entity UserRoleAssignment.
--> -->
<changeSet id="20190430154711-2" author="jhipster"> <changeSet id="20190507105342-2" author="jhipster">
<addForeignKeyConstraint baseColumnNames="user_id" <addForeignKeyConstraint baseColumnNames="user_id"
baseTableName="user_role_assignment" baseTableName="user_role_assignment"

View File

@ -5,17 +5,17 @@
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd"> xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd">
<include file="config/liquibase/changelog/00000000000000_initial_schema.xml" relativeToChangelogFile="false"/> <include file="config/liquibase/changelog/00000000000000_initial_schema.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190430152136_added_entity_Customer.xml" relativeToChangelogFile="false"/> <include file="config/liquibase/changelog/20190507105332_added_entity_Customer.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190430152137_added_entity_Membership.xml" relativeToChangelogFile="false"/> <include file="config/liquibase/changelog/20190507105333_added_entity_Membership.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190430152138_added_entity_Share.xml" relativeToChangelogFile="false"/> <include file="config/liquibase/changelog/20190507105334_added_entity_Share.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190430152139_added_entity_Asset.xml" relativeToChangelogFile="false"/> <include file="config/liquibase/changelog/20190507105335_added_entity_Asset.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190430152140_added_entity_SepaMandate.xml" relativeToChangelogFile="false"/> <include file="config/liquibase/changelog/20190507105336_added_entity_SepaMandate.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190430154711_added_entity_UserRoleAssignment.xml" relativeToChangelogFile="false"/> <include file="config/liquibase/changelog/20190507105342_added_entity_UserRoleAssignment.xml" relativeToChangelogFile="false"/>
<!-- jhipster-needle-liquibase-add-changelog - JHipster will add liquibase changelogs here --> <!-- jhipster-needle-liquibase-add-changelog - JHipster will add liquibase changelogs here -->
<include file="config/liquibase/changelog/20190430152137_added_entity_constraints_Membership.xml" relativeToChangelogFile="false"/> <include file="config/liquibase/changelog/20190507105333_added_entity_constraints_Membership.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190430152138_added_entity_constraints_Share.xml" relativeToChangelogFile="false"/> <include file="config/liquibase/changelog/20190507105334_added_entity_constraints_Share.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190430152139_added_entity_constraints_Asset.xml" relativeToChangelogFile="false"/> <include file="config/liquibase/changelog/20190507105335_added_entity_constraints_Asset.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190430152140_added_entity_constraints_SepaMandate.xml" relativeToChangelogFile="false"/> <include file="config/liquibase/changelog/20190507105336_added_entity_constraints_SepaMandate.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20190430154711_added_entity_constraints_UserRoleAssignment.xml" relativeToChangelogFile="false"/> <include file="config/liquibase/changelog/20190507105342_added_entity_constraints_UserRoleAssignment.xml" relativeToChangelogFile="false"/>
<!-- jhipster-needle-liquibase-add-constraints-changelog - JHipster will add liquibase constraints changelogs here --> <!-- jhipster-needle-liquibase-add-constraints-changelog - JHipster will add liquibase constraints changelogs here -->
</databaseChangeLog> </databaseChangeLog>

View File

@ -12,12 +12,32 @@
<div class="form-group"> <div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.userRoleAssignment.entityTypeId" for="field_entityTypeId">Entity Type Id</label> <label class="form-control-label" jhiTranslate="hsadminNgApp.userRoleAssignment.entityTypeId" for="field_entityTypeId">Entity Type Id</label>
<input type="text" class="form-control" name="entityTypeId" id="field_entityTypeId" <input type="text" class="form-control" name="entityTypeId" id="field_entityTypeId"
[(ngModel)]="userRoleAssignment.entityTypeId" /> [(ngModel)]="userRoleAssignment.entityTypeId" required maxlength="32"/>
<div [hidden]="!(editForm.controls.entityTypeId?.dirty && editForm.controls.entityTypeId?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.entityTypeId?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
<small class="form-text text-danger"
[hidden]="!editForm.controls.entityTypeId?.errors?.maxlength" jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 32 }">
This field cannot be longer than 32 characters.
</small>
</div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.userRoleAssignment.entityObjectId" for="field_entityObjectId">Entity Object Id</label> <label class="form-control-label" jhiTranslate="hsadminNgApp.userRoleAssignment.entityObjectId" for="field_entityObjectId">Entity Object Id</label>
<input type="number" class="form-control" name="entityObjectId" id="field_entityObjectId" <input type="number" class="form-control" name="entityObjectId" id="field_entityObjectId"
[(ngModel)]="userRoleAssignment.entityObjectId" /> [(ngModel)]="userRoleAssignment.entityObjectId" required/>
<div [hidden]="!(editForm.controls.entityObjectId?.dirty && editForm.controls.entityObjectId?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.entityObjectId?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
<small class="form-text text-danger"
[hidden]="!editForm.controls.entityObjectId?.errors?.number" jhiTranslate="entity.validation.number">
This field should be a number.
</small>
</div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.userRoleAssignment.assignedRole" for="field_assignedRole">Assigned Role</label> <label class="form-control-label" jhiTranslate="hsadminNgApp.userRoleAssignment.assignedRole" for="field_assignedRole">Assigned Role</label>

View File

@ -1,7 +1,8 @@
{ {
"global": { "global": {
"title": "HsadminNg", "title": "HsadminNg",
"browsehappy": "Sie benutzen einen <strong>veralteten</strong> Browser. Bitte <a href=\"http://browsehappy.com/?locale=de/\">aktualisieren Sie Ihren Browser</a>, um die Benutzerfreundlichkeit zu erhöhen.", "browsehappy":
"Sie benutzen einen <strong>veralteten</strong> Browser. Bitte <a href=\"http://browsehappy.com/?locale=de/\">aktualisieren Sie Ihren Browser</a>, um die Benutzerfreundlichkeit zu erhöhen.",
"menu": { "menu": {
"home": "Startseite", "home": "Startseite",
"jhipster-needle-menu-add-element": "JHipster will add additional menu entries here (do not translate!)", "jhipster-needle-menu-add-element": "JHipster will add additional menu entries here (do not translate!)",
@ -56,7 +57,8 @@
"authenticated": { "authenticated": {
"prefix": "Wenn Sie sich ", "prefix": "Wenn Sie sich ",
"link": "anmelden", "link": "anmelden",
"suffix": " möchten, versuchen Sie es mit <br/>- Administrator (Name=\"admin\" und Passwort=\"admin\")<br/>- Benutzer (Name=\"user\" und Passwort=\"user\")." "suffix":
" möchten, versuchen Sie es mit <br/>- Administrator (Name=\"admin\" und Passwort=\"admin\")<br/>- Benutzer (Name=\"user\" und Passwort=\"user\")."
}, },
"register": { "register": {
"noaccount": "Sie haben noch keinen Zugang?", "noaccount": "Sie haben noch keinen Zugang?",

View File

@ -1,7 +1,8 @@
{ {
"global": { "global": {
"title": "HsadminNg", "title": "HsadminNg",
"browsehappy": "You are using an <strong>outdated</strong> browser. Please <a href=\"http://browsehappy.com/?locale=en\">upgrade your browser</a> to improve your experience.", "browsehappy":
"You are using an <strong>outdated</strong> browser. Please <a href=\"http://browsehappy.com/?locale=en\">upgrade your browser</a> to improve your experience.",
"menu": { "menu": {
"home": "Home", "home": "Home",
"jhipster-needle-menu-add-element": "JHipster will add additional menu entries here (do not translate!)", "jhipster-needle-menu-add-element": "JHipster will add additional menu entries here (do not translate!)",
@ -56,7 +57,8 @@
"authenticated": { "authenticated": {
"prefix": "If you want to ", "prefix": "If you want to ",
"link": "sign in", "link": "sign in",
"suffix": ", you can try the default accounts:<br/>- Administrator (login=\"admin\" and password=\"admin\") <br/>- User (login=\"user\" and password=\"user\")." "suffix":
", you can try the default accounts:<br/>- Administrator (login=\"admin\" and password=\"admin\") <br/>- User (login=\"user\" and password=\"user\")."
}, },
"register": { "register": {
"noaccount": "You don't have an account yet?", "noaccount": "You don't have an account yet?",

View File

@ -53,8 +53,8 @@ public class CustomerResourceIntTest {
private static final Integer DEFAULT_REFERENCE = 10000; private static final Integer DEFAULT_REFERENCE = 10000;
private static final Integer UPDATED_REFERENCE = 10001; private static final Integer UPDATED_REFERENCE = 10001;
private static final String DEFAULT_PREFIX = "z4a"; private static final String DEFAULT_PREFIX = "y5j";
private static final String UPDATED_PREFIX = "dr"; private static final String UPDATED_PREFIX = "f0u";
private static final String DEFAULT_NAME = "AAAAAAAAAA"; private static final String DEFAULT_NAME = "AAAAAAAAAA";
private static final String UPDATED_NAME = "BBBBBBBBBB"; private static final String UPDATED_NAME = "BBBBBBBBBB";

View File

@ -156,6 +156,44 @@ public class UserRoleAssignmentResourceIntTest {
assertThat(userRoleAssignmentList).hasSize(databaseSizeBeforeCreate); 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<UserRoleAssignment> 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<UserRoleAssignment> userRoleAssignmentList = userRoleAssignmentRepository.findAll();
assertThat(userRoleAssignmentList).hasSize(databaseSizeBeforeTest);
}
@Test @Test
@Transactional @Transactional
public void checkAssignedRoleIsRequired() throws Exception { public void checkAssignedRoleIsRequired() throws Exception {

View File

@ -28,33 +28,39 @@ describe('Component Tests', () => {
}); });
describe('save', () => { describe('save', () => {
it('Should call update service on save for existing entity', fakeAsync(() => { it(
// GIVEN 'Should call update service on save for existing entity',
const entity = new Asset(123); fakeAsync(() => {
spyOn(service, 'update').and.returnValue(of(new HttpResponse({ body: entity }))); // GIVEN
comp.asset = entity; const entity = new Asset(123);
// WHEN spyOn(service, 'update').and.returnValue(of(new HttpResponse({ body: entity })));
comp.save(); comp.asset = entity;
tick(); // simulate async // WHEN
comp.save();
tick(); // simulate async
// THEN // THEN
expect(service.update).toHaveBeenCalledWith(entity); expect(service.update).toHaveBeenCalledWith(entity);
expect(comp.isSaving).toEqual(false); expect(comp.isSaving).toEqual(false);
})); })
);
it('Should call create service on save for new entity', fakeAsync(() => { it(
// GIVEN 'Should call create service on save for new entity',
const entity = new Asset(); fakeAsync(() => {
spyOn(service, 'create').and.returnValue(of(new HttpResponse({ body: entity }))); // GIVEN
comp.asset = entity; const entity = new Asset();
// WHEN spyOn(service, 'create').and.returnValue(of(new HttpResponse({ body: entity })));
comp.save(); comp.asset = entity;
tick(); // simulate async // WHEN
comp.save();
tick(); // simulate async
// THEN // THEN
expect(service.create).toHaveBeenCalledWith(entity); expect(service.create).toHaveBeenCalledWith(entity);
expect(comp.isSaving).toEqual(false); expect(comp.isSaving).toEqual(false);
})); })
);
}); });
}); });
}); });

View File

@ -28,33 +28,39 @@ describe('Component Tests', () => {
}); });
describe('save', () => { describe('save', () => {
it('Should call update service on save for existing entity', fakeAsync(() => { it(
// GIVEN 'Should call update service on save for existing entity',
const entity = new Customer(123); fakeAsync(() => {
spyOn(service, 'update').and.returnValue(of(new HttpResponse({ body: entity }))); // GIVEN
comp.customer = entity; const entity = new Customer(123);
// WHEN spyOn(service, 'update').and.returnValue(of(new HttpResponse({ body: entity })));
comp.save(); comp.customer = entity;
tick(); // simulate async // WHEN
comp.save();
tick(); // simulate async
// THEN // THEN
expect(service.update).toHaveBeenCalledWith(entity); expect(service.update).toHaveBeenCalledWith(entity);
expect(comp.isSaving).toEqual(false); expect(comp.isSaving).toEqual(false);
})); })
);
it('Should call create service on save for new entity', fakeAsync(() => { it(
// GIVEN 'Should call create service on save for new entity',
const entity = new Customer(); fakeAsync(() => {
spyOn(service, 'create').and.returnValue(of(new HttpResponse({ body: entity }))); // GIVEN
comp.customer = entity; const entity = new Customer();
// WHEN spyOn(service, 'create').and.returnValue(of(new HttpResponse({ body: entity })));
comp.save(); comp.customer = entity;
tick(); // simulate async // WHEN
comp.save();
tick(); // simulate async
// THEN // THEN
expect(service.create).toHaveBeenCalledWith(entity); expect(service.create).toHaveBeenCalledWith(entity);
expect(comp.isSaving).toEqual(false); expect(comp.isSaving).toEqual(false);
})); })
);
}); });
}); });
}); });

View File

@ -28,33 +28,39 @@ describe('Component Tests', () => {
}); });
describe('save', () => { describe('save', () => {
it('Should call update service on save for existing entity', fakeAsync(() => { it(
// GIVEN 'Should call update service on save for existing entity',
const entity = new Membership(123); fakeAsync(() => {
spyOn(service, 'update').and.returnValue(of(new HttpResponse({ body: entity }))); // GIVEN
comp.membership = entity; const entity = new Membership(123);
// WHEN spyOn(service, 'update').and.returnValue(of(new HttpResponse({ body: entity })));
comp.save(); comp.membership = entity;
tick(); // simulate async // WHEN
comp.save();
tick(); // simulate async
// THEN // THEN
expect(service.update).toHaveBeenCalledWith(entity); expect(service.update).toHaveBeenCalledWith(entity);
expect(comp.isSaving).toEqual(false); expect(comp.isSaving).toEqual(false);
})); })
);
it('Should call create service on save for new entity', fakeAsync(() => { it(
// GIVEN 'Should call create service on save for new entity',
const entity = new Membership(); fakeAsync(() => {
spyOn(service, 'create').and.returnValue(of(new HttpResponse({ body: entity }))); // GIVEN
comp.membership = entity; const entity = new Membership();
// WHEN spyOn(service, 'create').and.returnValue(of(new HttpResponse({ body: entity })));
comp.save(); comp.membership = entity;
tick(); // simulate async // WHEN
comp.save();
tick(); // simulate async
// THEN // THEN
expect(service.create).toHaveBeenCalledWith(entity); expect(service.create).toHaveBeenCalledWith(entity);
expect(comp.isSaving).toEqual(false); expect(comp.isSaving).toEqual(false);
})); })
);
}); });
}); });
}); });

View File

@ -28,33 +28,39 @@ describe('Component Tests', () => {
}); });
describe('save', () => { describe('save', () => {
it('Should call update service on save for existing entity', fakeAsync(() => { it(
// GIVEN 'Should call update service on save for existing entity',
const entity = new SepaMandate(123); fakeAsync(() => {
spyOn(service, 'update').and.returnValue(of(new HttpResponse({ body: entity }))); // GIVEN
comp.sepaMandate = entity; const entity = new SepaMandate(123);
// WHEN spyOn(service, 'update').and.returnValue(of(new HttpResponse({ body: entity })));
comp.save(); comp.sepaMandate = entity;
tick(); // simulate async // WHEN
comp.save();
tick(); // simulate async
// THEN // THEN
expect(service.update).toHaveBeenCalledWith(entity); expect(service.update).toHaveBeenCalledWith(entity);
expect(comp.isSaving).toEqual(false); expect(comp.isSaving).toEqual(false);
})); })
);
it('Should call create service on save for new entity', fakeAsync(() => { it(
// GIVEN 'Should call create service on save for new entity',
const entity = new SepaMandate(); fakeAsync(() => {
spyOn(service, 'create').and.returnValue(of(new HttpResponse({ body: entity }))); // GIVEN
comp.sepaMandate = entity; const entity = new SepaMandate();
// WHEN spyOn(service, 'create').and.returnValue(of(new HttpResponse({ body: entity })));
comp.save(); comp.sepaMandate = entity;
tick(); // simulate async // WHEN
comp.save();
tick(); // simulate async
// THEN // THEN
expect(service.create).toHaveBeenCalledWith(entity); expect(service.create).toHaveBeenCalledWith(entity);
expect(comp.isSaving).toEqual(false); expect(comp.isSaving).toEqual(false);
})); })
);
}); });
}); });
}); });

View File

@ -28,33 +28,39 @@ describe('Component Tests', () => {
}); });
describe('save', () => { describe('save', () => {
it('Should call update service on save for existing entity', fakeAsync(() => { it(
// GIVEN 'Should call update service on save for existing entity',
const entity = new Share(123); fakeAsync(() => {
spyOn(service, 'update').and.returnValue(of(new HttpResponse({ body: entity }))); // GIVEN
comp.share = entity; const entity = new Share(123);
// WHEN spyOn(service, 'update').and.returnValue(of(new HttpResponse({ body: entity })));
comp.save(); comp.share = entity;
tick(); // simulate async // WHEN
comp.save();
tick(); // simulate async
// THEN // THEN
expect(service.update).toHaveBeenCalledWith(entity); expect(service.update).toHaveBeenCalledWith(entity);
expect(comp.isSaving).toEqual(false); expect(comp.isSaving).toEqual(false);
})); })
);
it('Should call create service on save for new entity', fakeAsync(() => { it(
// GIVEN 'Should call create service on save for new entity',
const entity = new Share(); fakeAsync(() => {
spyOn(service, 'create').and.returnValue(of(new HttpResponse({ body: entity }))); // GIVEN
comp.share = entity; const entity = new Share();
// WHEN spyOn(service, 'create').and.returnValue(of(new HttpResponse({ body: entity })));
comp.save(); comp.share = entity;
tick(); // simulate async // WHEN
comp.save();
tick(); // simulate async
// THEN // THEN
expect(service.create).toHaveBeenCalledWith(entity); expect(service.create).toHaveBeenCalledWith(entity);
expect(comp.isSaving).toEqual(false); expect(comp.isSaving).toEqual(false);
})); })
);
}); });
}); });
}); });

View File

@ -28,33 +28,39 @@ describe('Component Tests', () => {
}); });
describe('save', () => { describe('save', () => {
it('Should call update service on save for existing entity', fakeAsync(() => { it(
// GIVEN 'Should call update service on save for existing entity',
const entity = new UserRoleAssignment(123); fakeAsync(() => {
spyOn(service, 'update').and.returnValue(of(new HttpResponse({ body: entity }))); // GIVEN
comp.userRoleAssignment = entity; const entity = new UserRoleAssignment(123);
// WHEN spyOn(service, 'update').and.returnValue(of(new HttpResponse({ body: entity })));
comp.save(); comp.userRoleAssignment = entity;
tick(); // simulate async // WHEN
comp.save();
tick(); // simulate async
// THEN // THEN
expect(service.update).toHaveBeenCalledWith(entity); expect(service.update).toHaveBeenCalledWith(entity);
expect(comp.isSaving).toEqual(false); expect(comp.isSaving).toEqual(false);
})); })
);
it('Should call create service on save for new entity', fakeAsync(() => { it(
// GIVEN 'Should call create service on save for new entity',
const entity = new UserRoleAssignment(); fakeAsync(() => {
spyOn(service, 'create').and.returnValue(of(new HttpResponse({ body: entity }))); // GIVEN
comp.userRoleAssignment = entity; const entity = new UserRoleAssignment();
// WHEN spyOn(service, 'create').and.returnValue(of(new HttpResponse({ body: entity })));
comp.save(); comp.userRoleAssignment = entity;
tick(); // simulate async // WHEN
comp.save();
tick(); // simulate async
// THEN // THEN
expect(service.create).toHaveBeenCalledWith(entity); expect(service.create).toHaveBeenCalledWith(entity);
expect(comp.isSaving).toEqual(false); expect(comp.isSaving).toEqual(false);
})); })
);
}); });
}); });
}); });