Skip to content

Commit

Permalink
use generatePKeyValue in ResourceIT tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tcharl committed Apr 14, 2021
1 parent 0aa5542 commit 8d3b4df
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
-%>
// Initialize the database
<%_ if (!primaryKey.autoGenerate && !databaseTypeSql) { _%>
<%_ if (primaryKey.typeUUID) { _%>
<%= persistInstance %>.set<%= primaryKey.nameCapitalized %>(UUID.randomUUID());
<%_ } _%>
<%= persistInstance %>.set<%= primaryKey.nameCapitalized %>(<%- getPrimaryKeyValue(primaryKey.type, databaseType) -%>);
<%_ } _%>
<%= entityInstance %>Repository.<%= saveMethod %>(<%= persistInstance %>)<%= callBlock %>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1515,13 +1515,13 @@ class <%= entityClass %>ResourceIT <% if (databaseType === 'cassandra') { %>exte
@Test<%= transactionalAnnotation %>
void partialUpdate<%= entityClass %>WithPatch() throws Exception {
<% const fieldsToIncludeInPartialPatchTest = fields.filter(field => !field.id && !field.transient).map(field => prepareFieldForPatchTest(field, () => faker.datatype.boolean())); %>
<%- include('/partials/it_patch_update.partial.java.ejs', {fields: fieldsToIncludeInPartialPatchTest, saveMethod, asEntity, callBlock, callListBlock}); -%>
<%- include('/partials/it_patch_update.partial.java.ejs', {fields: fieldsToIncludeInPartialPatchTest, saveMethod, asEntity, callBlock, callListBlock, getPrimaryKeyValue}); -%>
}

@Test<%= transactionalAnnotation %>
void fullUpdate<%= entityClass %>WithPatch() throws Exception {
<% const fieldsToIncludeInFullPatchTest = fields.filter(field => !field.id && !field.transient).map(field => prepareFieldForPatchTest(field, () => true)); %>
<%- include('/partials/it_patch_update.partial.java.ejs', {fields: fieldsToIncludeInFullPatchTest, saveMethod, asEntity, callBlock, callListBlock}); -%>
<%- include('/partials/it_patch_update.partial.java.ejs', {fields: fieldsToIncludeInFullPatchTest, saveMethod, asEntity, callBlock, callListBlock, getPrimaryKeyValue}); -%>
}

@Test<%= transactionalAnnotation %>
Expand Down
1 change: 0 additions & 1 deletion utils/entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,6 @@ function prepareEntityPrimaryKeyForTemplates(entityWithConfig, generator, enable
name: primaryKeyName,
nameCapitalized: _.upperFirst(primaryKeyName),
type: primaryKeyType,
typeUUID: primaryKeyType === UUID,
tsType: generator.getTypescriptKeyType(primaryKeyType),
composite,
relationships: idRelationships,
Expand Down

0 comments on commit 8d3b4df

Please sign in to comment.