Merge branch 'jhipster-generated'

This commit is contained in:
Michael Hoennig 2019-04-04 09:21:25 +02:00
commit 09da027bed
16 changed files with 723 additions and 8 deletions

View File

@ -22,6 +22,48 @@
"pattern"
],
"fieldValidateRulesPattern": "[a-z][a-z0-9]+"
},
{
"fieldName": "name",
"fieldType": "String",
"fieldValidateRules": [
"required",
"maxlength"
],
"fieldValidateRulesMaxlength": 80
},
{
"fieldName": "contractualAddress",
"fieldType": "String",
"fieldValidateRules": [
"required",
"maxlength"
],
"fieldValidateRulesMaxlength": 400
},
{
"fieldName": "contractualSalutation",
"fieldType": "String",
"fieldValidateRules": [
"maxlength"
],
"fieldValidateRulesMaxlength": 80
},
{
"fieldName": "billingAddress",
"fieldType": "String",
"fieldValidateRules": [
"maxlength"
],
"fieldValidateRulesMaxlength": 400
},
{
"fieldName": "billingSalutation",
"fieldType": "String",
"fieldValidateRules": [
"maxlength"
],
"fieldValidateRulesMaxlength": 80
}
],
"relationships": [

View File

@ -36,6 +36,28 @@ public class Customer implements Serializable {
@Column(name = "prefix", nullable = false, unique = true)
private String prefix;
@NotNull
@Size(max = 80)
@Column(name = "name", length = 80, nullable = false)
private String name;
@NotNull
@Size(max = 400)
@Column(name = "contractual_address", length = 400, nullable = false)
private String contractualAddress;
@Size(max = 80)
@Column(name = "contractual_salutation", length = 80)
private String contractualSalutation;
@Size(max = 400)
@Column(name = "billing_address", length = 400)
private String billingAddress;
@Size(max = 80)
@Column(name = "billing_salutation", length = 80)
private String billingSalutation;
@OneToMany(mappedBy = "customer")
private Set<Membership> memberships = new HashSet<>();
@OneToMany(mappedBy = "customer")
@ -75,6 +97,71 @@ public class Customer implements Serializable {
this.prefix = prefix;
}
public String getName() {
return name;
}
public Customer name(String name) {
this.name = name;
return this;
}
public void setName(String name) {
this.name = name;
}
public String getContractualAddress() {
return contractualAddress;
}
public Customer contractualAddress(String contractualAddress) {
this.contractualAddress = contractualAddress;
return this;
}
public void setContractualAddress(String contractualAddress) {
this.contractualAddress = contractualAddress;
}
public String getContractualSalutation() {
return contractualSalutation;
}
public Customer contractualSalutation(String contractualSalutation) {
this.contractualSalutation = contractualSalutation;
return this;
}
public void setContractualSalutation(String contractualSalutation) {
this.contractualSalutation = contractualSalutation;
}
public String getBillingAddress() {
return billingAddress;
}
public Customer billingAddress(String billingAddress) {
this.billingAddress = billingAddress;
return this;
}
public void setBillingAddress(String billingAddress) {
this.billingAddress = billingAddress;
}
public String getBillingSalutation() {
return billingSalutation;
}
public Customer billingSalutation(String billingSalutation) {
this.billingSalutation = billingSalutation;
return this;
}
public void setBillingSalutation(String billingSalutation) {
this.billingSalutation = billingSalutation;
}
public Set<Membership> getMemberships() {
return memberships;
}
@ -152,6 +239,11 @@ public class Customer implements Serializable {
"id=" + getId() +
", number=" + getNumber() +
", prefix='" + getPrefix() + "'" +
", name='" + getName() + "'" +
", contractualAddress='" + getContractualAddress() + "'" +
", contractualSalutation='" + getContractualSalutation() + "'" +
", billingAddress='" + getBillingAddress() + "'" +
", billingSalutation='" + getBillingSalutation() + "'" +
"}";
}
}

View File

@ -95,6 +95,21 @@ public class CustomerQueryService extends QueryService<Customer> {
if (criteria.getPrefix() != null) {
specification = specification.and(buildStringSpecification(criteria.getPrefix(), Customer_.prefix));
}
if (criteria.getName() != null) {
specification = specification.and(buildStringSpecification(criteria.getName(), Customer_.name));
}
if (criteria.getContractualAddress() != null) {
specification = specification.and(buildStringSpecification(criteria.getContractualAddress(), Customer_.contractualAddress));
}
if (criteria.getContractualSalutation() != null) {
specification = specification.and(buildStringSpecification(criteria.getContractualSalutation(), Customer_.contractualSalutation));
}
if (criteria.getBillingAddress() != null) {
specification = specification.and(buildStringSpecification(criteria.getBillingAddress(), Customer_.billingAddress));
}
if (criteria.getBillingSalutation() != null) {
specification = specification.and(buildStringSpecification(criteria.getBillingSalutation(), Customer_.billingSalutation));
}
if (criteria.getMembershipId() != null) {
specification = specification.and(buildSpecification(criteria.getMembershipId(),
root -> root.join(Customer_.memberships, JoinType.LEFT).get(Membership_.id)));

View File

@ -28,6 +28,16 @@ public class CustomerCriteria implements Serializable {
private StringFilter prefix;
private StringFilter name;
private StringFilter contractualAddress;
private StringFilter contractualSalutation;
private StringFilter billingAddress;
private StringFilter billingSalutation;
private LongFilter membershipId;
private LongFilter roleId;
@ -56,6 +66,46 @@ public class CustomerCriteria implements Serializable {
this.prefix = prefix;
}
public StringFilter getName() {
return name;
}
public void setName(StringFilter name) {
this.name = name;
}
public StringFilter getContractualAddress() {
return contractualAddress;
}
public void setContractualAddress(StringFilter contractualAddress) {
this.contractualAddress = contractualAddress;
}
public StringFilter getContractualSalutation() {
return contractualSalutation;
}
public void setContractualSalutation(StringFilter contractualSalutation) {
this.contractualSalutation = contractualSalutation;
}
public StringFilter getBillingAddress() {
return billingAddress;
}
public void setBillingAddress(StringFilter billingAddress) {
this.billingAddress = billingAddress;
}
public StringFilter getBillingSalutation() {
return billingSalutation;
}
public void setBillingSalutation(StringFilter billingSalutation) {
this.billingSalutation = billingSalutation;
}
public LongFilter getMembershipId() {
return membershipId;
}
@ -86,6 +136,11 @@ public class CustomerCriteria implements Serializable {
Objects.equals(id, that.id) &&
Objects.equals(number, that.number) &&
Objects.equals(prefix, that.prefix) &&
Objects.equals(name, that.name) &&
Objects.equals(contractualAddress, that.contractualAddress) &&
Objects.equals(contractualSalutation, that.contractualSalutation) &&
Objects.equals(billingAddress, that.billingAddress) &&
Objects.equals(billingSalutation, that.billingSalutation) &&
Objects.equals(membershipId, that.membershipId) &&
Objects.equals(roleId, that.roleId);
}
@ -96,6 +151,11 @@ public class CustomerCriteria implements Serializable {
id,
number,
prefix,
name,
contractualAddress,
contractualSalutation,
billingAddress,
billingSalutation,
membershipId,
roleId
);
@ -107,6 +167,11 @@ public class CustomerCriteria implements Serializable {
(id != null ? "id=" + id + ", " : "") +
(number != null ? "number=" + number + ", " : "") +
(prefix != null ? "prefix=" + prefix + ", " : "") +
(name != null ? "name=" + name + ", " : "") +
(contractualAddress != null ? "contractualAddress=" + contractualAddress + ", " : "") +
(contractualSalutation != null ? "contractualSalutation=" + contractualSalutation + ", " : "") +
(billingAddress != null ? "billingAddress=" + billingAddress + ", " : "") +
(billingSalutation != null ? "billingSalutation=" + billingSalutation + ", " : "") +
(membershipId != null ? "membershipId=" + membershipId + ", " : "") +
(roleId != null ? "roleId=" + roleId + ", " : "") +
"}";

View File

@ -19,6 +19,23 @@ public class CustomerDTO implements Serializable {
@Pattern(regexp = "[a-z][a-z0-9]+")
private String prefix;
@NotNull
@Size(max = 80)
private String name;
@NotNull
@Size(max = 400)
private String contractualAddress;
@Size(max = 80)
private String contractualSalutation;
@Size(max = 400)
private String billingAddress;
@Size(max = 80)
private String billingSalutation;
public Long getId() {
return id;
@ -44,6 +61,46 @@ public class CustomerDTO implements Serializable {
this.prefix = prefix;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getContractualAddress() {
return contractualAddress;
}
public void setContractualAddress(String contractualAddress) {
this.contractualAddress = contractualAddress;
}
public String getContractualSalutation() {
return contractualSalutation;
}
public void setContractualSalutation(String contractualSalutation) {
this.contractualSalutation = contractualSalutation;
}
public String getBillingAddress() {
return billingAddress;
}
public void setBillingAddress(String billingAddress) {
this.billingAddress = billingAddress;
}
public String getBillingSalutation() {
return billingSalutation;
}
public void setBillingSalutation(String billingSalutation) {
this.billingSalutation = billingSalutation;
}
@Override
public boolean equals(Object o) {
if (this == o) {
@ -71,6 +128,11 @@ public class CustomerDTO implements Serializable {
"id=" + getId() +
", number=" + getNumber() +
", prefix='" + getPrefix() + "'" +
", name='" + getName() + "'" +
", contractualAddress='" + getContractualAddress() + "'" +
", contractualSalutation='" + getContractualSalutation() + "'" +
", billingAddress='" + getBillingAddress() + "'" +
", billingSalutation='" + getBillingSalutation() + "'" +
"}";
}
}

View File

@ -6,6 +6,11 @@ paginate all with infinite-scroll
entity Customer {
number Integer required unique min(10000) max(99999),
prefix String required unique pattern(/[a-z][a-z0-9]+/),
name String required maxlength(80),
contractualAddress String required maxlength(400),
contractualSalutation String maxlength(80),
billingAddress String maxlength(400),
billingSalutation String maxlength(80)
}
entity Contact {

View File

@ -29,6 +29,26 @@
<constraints nullable="false" unique="true" uniqueConstraintName="ux_customer_prefix" />
</column>
<column name="name" type="varchar(80)">
<constraints nullable="false" />
</column>
<column name="contractual_address" type="varchar(400)">
<constraints nullable="false" />
</column>
<column name="contractual_salutation" type="varchar(80)">
<constraints nullable="true" />
</column>
<column name="billing_address" type="varchar(400)">
<constraints nullable="true" />
</column>
<column name="billing_salutation" type="varchar(80)">
<constraints nullable="true" />
</column>
<!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove-->
</createTable>

View File

@ -13,6 +13,26 @@
<dd>
<span>{{customer.prefix}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.customer.name">Name</span></dt>
<dd>
<span>{{customer.name}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.customer.contractualAddress">Contractual Address</span></dt>
<dd>
<span>{{customer.contractualAddress}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.customer.contractualSalutation">Contractual Salutation</span></dt>
<dd>
<span>{{customer.contractualSalutation}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.customer.billingAddress">Billing Address</span></dt>
<dd>
<span>{{customer.billingAddress}}</span>
</dd>
<dt><span jhiTranslate="hsadminNgApp.customer.billingSalutation">Billing Salutation</span></dt>
<dd>
<span>{{customer.billingSalutation}}</span>
</dd>
</dl>
<button type="submit"

View File

@ -47,6 +47,69 @@
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.customer.name" for="field_name">Name</label>
<input type="text" class="form-control" name="name" id="field_name"
[(ngModel)]="customer.name" required maxlength="80"/>
<div [hidden]="!(editForm.controls.name?.dirty && editForm.controls.name?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.name?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
<small class="form-text text-danger"
[hidden]="!editForm.controls.name?.errors?.maxlength" jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 80 }">
This field cannot be longer than 80 characters.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.customer.contractualAddress" for="field_contractualAddress">Contractual Address</label>
<input type="text" class="form-control" name="contractualAddress" id="field_contractualAddress"
[(ngModel)]="customer.contractualAddress" required maxlength="400"/>
<div [hidden]="!(editForm.controls.contractualAddress?.dirty && editForm.controls.contractualAddress?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.contractualAddress?.errors?.required" jhiTranslate="entity.validation.required">
This field is required.
</small>
<small class="form-text text-danger"
[hidden]="!editForm.controls.contractualAddress?.errors?.maxlength" jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 400 }">
This field cannot be longer than 400 characters.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.customer.contractualSalutation" for="field_contractualSalutation">Contractual Salutation</label>
<input type="text" class="form-control" name="contractualSalutation" id="field_contractualSalutation"
[(ngModel)]="customer.contractualSalutation" maxlength="80"/>
<div [hidden]="!(editForm.controls.contractualSalutation?.dirty && editForm.controls.contractualSalutation?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.contractualSalutation?.errors?.maxlength" jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 80 }">
This field cannot be longer than 80 characters.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.customer.billingAddress" for="field_billingAddress">Billing Address</label>
<input type="text" class="form-control" name="billingAddress" id="field_billingAddress"
[(ngModel)]="customer.billingAddress" maxlength="400"/>
<div [hidden]="!(editForm.controls.billingAddress?.dirty && editForm.controls.billingAddress?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.billingAddress?.errors?.maxlength" jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 400 }">
This field cannot be longer than 400 characters.
</small>
</div>
</div>
<div class="form-group">
<label class="form-control-label" jhiTranslate="hsadminNgApp.customer.billingSalutation" for="field_billingSalutation">Billing Salutation</label>
<input type="text" class="form-control" name="billingSalutation" id="field_billingSalutation"
[(ngModel)]="customer.billingSalutation" maxlength="80"/>
<div [hidden]="!(editForm.controls.billingSalutation?.dirty && editForm.controls.billingSalutation?.invalid)">
<small class="form-text text-danger"
[hidden]="!editForm.controls.billingSalutation?.errors?.maxlength" jhiTranslate="entity.validation.maxlength" [translateValues]="{ max: 80 }">
This field cannot be longer than 80 characters.
</small>
</div>
</div>
</div>
<div>

View File

@ -17,6 +17,11 @@
<th jhiSortBy="id"><span jhiTranslate="global.field.id">ID</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="number"><span jhiTranslate="hsadminNgApp.customer.number">Number</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="prefix"><span jhiTranslate="hsadminNgApp.customer.prefix">Prefix</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="name"><span jhiTranslate="hsadminNgApp.customer.name">Name</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="contractualAddress"><span jhiTranslate="hsadminNgApp.customer.contractualAddress">Contractual Address</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="contractualSalutation"><span jhiTranslate="hsadminNgApp.customer.contractualSalutation">Contractual Salutation</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="billingAddress"><span jhiTranslate="hsadminNgApp.customer.billingAddress">Billing Address</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th jhiSortBy="billingSalutation"><span jhiTranslate="hsadminNgApp.customer.billingSalutation">Billing Salutation</span> <fa-icon [icon]="'sort'"></fa-icon></th>
<th></th>
</tr>
<tr>
@ -31,6 +36,11 @@
<td><a [routerLink]="['/customer', customer.id, 'view' ]">{{customer.id}}</a></td>
<td>{{customer.number}}</td>
<td>{{customer.prefix}}</td>
<td>{{customer.name}}</td>
<td>{{customer.contractualAddress}}</td>
<td>{{customer.contractualSalutation}}</td>
<td>{{customer.billingAddress}}</td>
<td>{{customer.billingSalutation}}</td>
<td class="text-right">
<div class="btn-group flex-btn-group-container">
<button type="submit"

View File

@ -27,6 +27,14 @@ import { RouterModule } from '@angular/router';
{
path: 'asset',
loadChildren: './asset/asset.module#HsadminNgAssetModule'
},
{
path: 'customer',
loadChildren: './customer/customer.module#HsadminNgCustomerModule'
},
{
path: 'customer',
loadChildren: './customer/customer.module#HsadminNgCustomerModule'
}
/* jhipster-needle-add-entity-route - JHipster will add entity modules routes here */
])

View File

@ -5,6 +5,11 @@ export interface ICustomer {
id?: number;
number?: number;
prefix?: string;
name?: string;
contractualAddress?: string;
contractualSalutation?: string;
billingAddress?: string;
billingSalutation?: string;
memberships?: IMembership[];
roles?: ICustomerContact[];
}
@ -14,6 +19,11 @@ export class Customer implements ICustomer {
public id?: number,
public number?: number,
public prefix?: string,
public name?: string,
public contractualAddress?: string,
public contractualSalutation?: string,
public billingAddress?: string,
public billingSalutation?: string,
public memberships?: IMembership[],
public roles?: ICustomerContact[]
) {}

View File

@ -17,6 +17,11 @@
},
"number": "Number",
"prefix": "Prefix",
"name": "Name",
"contractualAddress": "Contractual Address",
"contractualSalutation": "Contractual Salutation",
"billingAddress": "Billing Address",
"billingSalutation": "Billing Salutation",
"membership": "Membership",
"role": "Role"
}

View File

@ -17,6 +17,11 @@
},
"number": "Number",
"prefix": "Prefix",
"name": "Name",
"contractualAddress": "Contractual Address",
"contractualSalutation": "Contractual Salutation",
"billingAddress": "Billing Address",
"billingSalutation": "Billing Salutation",
"membership": "Membership",
"role": "Role"
}

View File

@ -55,6 +55,21 @@ public class CustomerResourceIntTest {
private static final String ANOTHER_PREFIX = "old";
private static final String UPDATED_PREFIX = "new";
private static final String DEFAULT_NAME = "AAAAAAAAAA";
private static final String UPDATED_NAME = "BBBBBBBBBB";
private static final String DEFAULT_CONTRACTUAL_ADDRESS = "AAAAAAAAAA";
private static final String UPDATED_CONTRACTUAL_ADDRESS = "BBBBBBBBBB";
private static final String DEFAULT_CONTRACTUAL_SALUTATION = "AAAAAAAAAA";
private static final String UPDATED_CONTRACTUAL_SALUTATION = "BBBBBBBBBB";
private static final String DEFAULT_BILLING_ADDRESS = "AAAAAAAAAA";
private static final String UPDATED_BILLING_ADDRESS = "BBBBBBBBBB";
private static final String DEFAULT_BILLING_SALUTATION = "AAAAAAAAAA";
private static final String UPDATED_BILLING_SALUTATION = "BBBBBBBBBB";
@Autowired
private CustomerRepository customerRepository;
@ -107,7 +122,12 @@ public class CustomerResourceIntTest {
public static Customer createEntity(EntityManager em) {
Customer customer = new Customer()
.number(DEFAULT_NUMBER)
.prefix(DEFAULT_PREFIX);
.prefix(DEFAULT_PREFIX)
.name(DEFAULT_NAME)
.contractualAddress(DEFAULT_CONTRACTUAL_ADDRESS)
.contractualSalutation(DEFAULT_CONTRACTUAL_SALUTATION)
.billingAddress(DEFAULT_BILLING_ADDRESS)
.billingSalutation(DEFAULT_BILLING_SALUTATION);
return customer;
}
@ -147,6 +167,11 @@ public class CustomerResourceIntTest {
Customer testCustomer = customerList.get(customerList.size() - 1);
assertThat(testCustomer.getNumber()).isEqualTo(DEFAULT_NUMBER);
assertThat(testCustomer.getPrefix()).isEqualTo(DEFAULT_PREFIX);
assertThat(testCustomer.getName()).isEqualTo(DEFAULT_NAME);
assertThat(testCustomer.getContractualAddress()).isEqualTo(DEFAULT_CONTRACTUAL_ADDRESS);
assertThat(testCustomer.getContractualSalutation()).isEqualTo(DEFAULT_CONTRACTUAL_SALUTATION);
assertThat(testCustomer.getBillingAddress()).isEqualTo(DEFAULT_BILLING_ADDRESS);
assertThat(testCustomer.getBillingSalutation()).isEqualTo(DEFAULT_BILLING_SALUTATION);
}
@Test
@ -207,6 +232,44 @@ public class CustomerResourceIntTest {
assertThat(customerList).hasSize(databaseSizeBeforeTest);
}
@Test
@Transactional
public void checkNameIsRequired() throws Exception {
int databaseSizeBeforeTest = customerRepository.findAll().size();
// set the field null
customer.setName(null);
// Create the Customer, which fails.
CustomerDTO customerDTO = customerMapper.toDto(customer);
restCustomerMockMvc.perform(post("/api/customers")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(customerDTO)))
.andExpect(status().isBadRequest());
List<Customer> customerList = customerRepository.findAll();
assertThat(customerList).hasSize(databaseSizeBeforeTest);
}
@Test
@Transactional
public void checkContractualAddressIsRequired() throws Exception {
int databaseSizeBeforeTest = customerRepository.findAll().size();
// set the field null
customer.setContractualAddress(null);
// Create the Customer, which fails.
CustomerDTO customerDTO = customerMapper.toDto(customer);
restCustomerMockMvc.perform(post("/api/customers")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(customerDTO)))
.andExpect(status().isBadRequest());
List<Customer> customerList = customerRepository.findAll();
assertThat(customerList).hasSize(databaseSizeBeforeTest);
}
@Test
@Transactional
public void getAllCustomers() throws Exception {
@ -219,7 +282,12 @@ public class CustomerResourceIntTest {
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.[*].id").value(hasItem(customer.getId().intValue())))
.andExpect(jsonPath("$.[*].number").value(hasItem(DEFAULT_NUMBER)))
.andExpect(jsonPath("$.[*].prefix").value(hasItem(DEFAULT_PREFIX.toString())));
.andExpect(jsonPath("$.[*].prefix").value(hasItem(DEFAULT_PREFIX.toString())))
.andExpect(jsonPath("$.[*].name").value(hasItem(DEFAULT_NAME.toString())))
.andExpect(jsonPath("$.[*].contractualAddress").value(hasItem(DEFAULT_CONTRACTUAL_ADDRESS.toString())))
.andExpect(jsonPath("$.[*].contractualSalutation").value(hasItem(DEFAULT_CONTRACTUAL_SALUTATION.toString())))
.andExpect(jsonPath("$.[*].billingAddress").value(hasItem(DEFAULT_BILLING_ADDRESS.toString())))
.andExpect(jsonPath("$.[*].billingSalutation").value(hasItem(DEFAULT_BILLING_SALUTATION.toString())));
}
@Test
@ -234,7 +302,12 @@ public class CustomerResourceIntTest {
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.id").value(customer.getId().intValue()))
.andExpect(jsonPath("$.number").value(DEFAULT_NUMBER))
.andExpect(jsonPath("$.prefix").value(DEFAULT_PREFIX.toString()));
.andExpect(jsonPath("$.prefix").value(DEFAULT_PREFIX.toString()))
.andExpect(jsonPath("$.name").value(DEFAULT_NAME.toString()))
.andExpect(jsonPath("$.contractualAddress").value(DEFAULT_CONTRACTUAL_ADDRESS.toString()))
.andExpect(jsonPath("$.contractualSalutation").value(DEFAULT_CONTRACTUAL_SALUTATION.toString()))
.andExpect(jsonPath("$.billingAddress").value(DEFAULT_BILLING_ADDRESS.toString()))
.andExpect(jsonPath("$.billingSalutation").value(DEFAULT_BILLING_SALUTATION.toString()));
}
@Test
@ -342,6 +415,201 @@ public class CustomerResourceIntTest {
defaultCustomerShouldNotBeFound("prefix.specified=false");
}
@Test
@Transactional
public void getAllCustomersByNameIsEqualToSomething() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where name equals to DEFAULT_NAME
defaultCustomerShouldBeFound("name.equals=" + DEFAULT_NAME);
// Get all the customerList where name equals to UPDATED_NAME
defaultCustomerShouldNotBeFound("name.equals=" + UPDATED_NAME);
}
@Test
@Transactional
public void getAllCustomersByNameIsInShouldWork() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where name in DEFAULT_NAME or UPDATED_NAME
defaultCustomerShouldBeFound("name.in=" + DEFAULT_NAME + "," + UPDATED_NAME);
// Get all the customerList where name equals to UPDATED_NAME
defaultCustomerShouldNotBeFound("name.in=" + UPDATED_NAME);
}
@Test
@Transactional
public void getAllCustomersByNameIsNullOrNotNull() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where name is not null
defaultCustomerShouldBeFound("name.specified=true");
// Get all the customerList where name is null
defaultCustomerShouldNotBeFound("name.specified=false");
}
@Test
@Transactional
public void getAllCustomersByContractualAddressIsEqualToSomething() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where contractualAddress equals to DEFAULT_CONTRACTUAL_ADDRESS
defaultCustomerShouldBeFound("contractualAddress.equals=" + DEFAULT_CONTRACTUAL_ADDRESS);
// Get all the customerList where contractualAddress equals to UPDATED_CONTRACTUAL_ADDRESS
defaultCustomerShouldNotBeFound("contractualAddress.equals=" + UPDATED_CONTRACTUAL_ADDRESS);
}
@Test
@Transactional
public void getAllCustomersByContractualAddressIsInShouldWork() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where contractualAddress in DEFAULT_CONTRACTUAL_ADDRESS or UPDATED_CONTRACTUAL_ADDRESS
defaultCustomerShouldBeFound("contractualAddress.in=" + DEFAULT_CONTRACTUAL_ADDRESS + "," + UPDATED_CONTRACTUAL_ADDRESS);
// Get all the customerList where contractualAddress equals to UPDATED_CONTRACTUAL_ADDRESS
defaultCustomerShouldNotBeFound("contractualAddress.in=" + UPDATED_CONTRACTUAL_ADDRESS);
}
@Test
@Transactional
public void getAllCustomersByContractualAddressIsNullOrNotNull() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where contractualAddress is not null
defaultCustomerShouldBeFound("contractualAddress.specified=true");
// Get all the customerList where contractualAddress is null
defaultCustomerShouldNotBeFound("contractualAddress.specified=false");
}
@Test
@Transactional
public void getAllCustomersByContractualSalutationIsEqualToSomething() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where contractualSalutation equals to DEFAULT_CONTRACTUAL_SALUTATION
defaultCustomerShouldBeFound("contractualSalutation.equals=" + DEFAULT_CONTRACTUAL_SALUTATION);
// Get all the customerList where contractualSalutation equals to UPDATED_CONTRACTUAL_SALUTATION
defaultCustomerShouldNotBeFound("contractualSalutation.equals=" + UPDATED_CONTRACTUAL_SALUTATION);
}
@Test
@Transactional
public void getAllCustomersByContractualSalutationIsInShouldWork() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where contractualSalutation in DEFAULT_CONTRACTUAL_SALUTATION or UPDATED_CONTRACTUAL_SALUTATION
defaultCustomerShouldBeFound("contractualSalutation.in=" + DEFAULT_CONTRACTUAL_SALUTATION + "," + UPDATED_CONTRACTUAL_SALUTATION);
// Get all the customerList where contractualSalutation equals to UPDATED_CONTRACTUAL_SALUTATION
defaultCustomerShouldNotBeFound("contractualSalutation.in=" + UPDATED_CONTRACTUAL_SALUTATION);
}
@Test
@Transactional
public void getAllCustomersByContractualSalutationIsNullOrNotNull() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where contractualSalutation is not null
defaultCustomerShouldBeFound("contractualSalutation.specified=true");
// Get all the customerList where contractualSalutation is null
defaultCustomerShouldNotBeFound("contractualSalutation.specified=false");
}
@Test
@Transactional
public void getAllCustomersByBillingAddressIsEqualToSomething() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where billingAddress equals to DEFAULT_BILLING_ADDRESS
defaultCustomerShouldBeFound("billingAddress.equals=" + DEFAULT_BILLING_ADDRESS);
// Get all the customerList where billingAddress equals to UPDATED_BILLING_ADDRESS
defaultCustomerShouldNotBeFound("billingAddress.equals=" + UPDATED_BILLING_ADDRESS);
}
@Test
@Transactional
public void getAllCustomersByBillingAddressIsInShouldWork() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where billingAddress in DEFAULT_BILLING_ADDRESS or UPDATED_BILLING_ADDRESS
defaultCustomerShouldBeFound("billingAddress.in=" + DEFAULT_BILLING_ADDRESS + "," + UPDATED_BILLING_ADDRESS);
// Get all the customerList where billingAddress equals to UPDATED_BILLING_ADDRESS
defaultCustomerShouldNotBeFound("billingAddress.in=" + UPDATED_BILLING_ADDRESS);
}
@Test
@Transactional
public void getAllCustomersByBillingAddressIsNullOrNotNull() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where billingAddress is not null
defaultCustomerShouldBeFound("billingAddress.specified=true");
// Get all the customerList where billingAddress is null
defaultCustomerShouldNotBeFound("billingAddress.specified=false");
}
@Test
@Transactional
public void getAllCustomersByBillingSalutationIsEqualToSomething() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where billingSalutation equals to DEFAULT_BILLING_SALUTATION
defaultCustomerShouldBeFound("billingSalutation.equals=" + DEFAULT_BILLING_SALUTATION);
// Get all the customerList where billingSalutation equals to UPDATED_BILLING_SALUTATION
defaultCustomerShouldNotBeFound("billingSalutation.equals=" + UPDATED_BILLING_SALUTATION);
}
@Test
@Transactional
public void getAllCustomersByBillingSalutationIsInShouldWork() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where billingSalutation in DEFAULT_BILLING_SALUTATION or UPDATED_BILLING_SALUTATION
defaultCustomerShouldBeFound("billingSalutation.in=" + DEFAULT_BILLING_SALUTATION + "," + UPDATED_BILLING_SALUTATION);
// Get all the customerList where billingSalutation equals to UPDATED_BILLING_SALUTATION
defaultCustomerShouldNotBeFound("billingSalutation.in=" + UPDATED_BILLING_SALUTATION);
}
@Test
@Transactional
public void getAllCustomersByBillingSalutationIsNullOrNotNull() throws Exception {
// Initialize the database
customerRepository.saveAndFlush(customer);
// Get all the customerList where billingSalutation is not null
defaultCustomerShouldBeFound("billingSalutation.specified=true");
// Get all the customerList where billingSalutation is null
defaultCustomerShouldNotBeFound("billingSalutation.specified=false");
}
@Test
@Transactional
public void getAllCustomersByMembershipIsEqualToSomething() throws Exception {
@ -388,7 +656,12 @@ public class CustomerResourceIntTest {
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.[*].id").value(hasItem(customer.getId().intValue())))
.andExpect(jsonPath("$.[*].number").value(hasItem(DEFAULT_NUMBER)))
.andExpect(jsonPath("$.[*].prefix").value(hasItem(DEFAULT_PREFIX)));
.andExpect(jsonPath("$.[*].prefix").value(hasItem(DEFAULT_PREFIX)))
.andExpect(jsonPath("$.[*].name").value(hasItem(DEFAULT_NAME)))
.andExpect(jsonPath("$.[*].contractualAddress").value(hasItem(DEFAULT_CONTRACTUAL_ADDRESS)))
.andExpect(jsonPath("$.[*].contractualSalutation").value(hasItem(DEFAULT_CONTRACTUAL_SALUTATION)))
.andExpect(jsonPath("$.[*].billingAddress").value(hasItem(DEFAULT_BILLING_ADDRESS)))
.andExpect(jsonPath("$.[*].billingSalutation").value(hasItem(DEFAULT_BILLING_SALUTATION)));
// Check, that the count call also returns 1
restCustomerMockMvc.perform(get("/api/customers/count?sort=id,desc&" + filter))
@ -437,7 +710,12 @@ public class CustomerResourceIntTest {
em.detach(updatedCustomer);
updatedCustomer
.number(UPDATED_NUMBER)
.prefix(UPDATED_PREFIX);
.prefix(UPDATED_PREFIX)
.name(UPDATED_NAME)
.contractualAddress(UPDATED_CONTRACTUAL_ADDRESS)
.contractualSalutation(UPDATED_CONTRACTUAL_SALUTATION)
.billingAddress(UPDATED_BILLING_ADDRESS)
.billingSalutation(UPDATED_BILLING_SALUTATION);
CustomerDTO customerDTO = customerMapper.toDto(updatedCustomer);
restCustomerMockMvc.perform(put("/api/customers")
@ -451,6 +729,11 @@ public class CustomerResourceIntTest {
Customer testCustomer = customerList.get(customerList.size() - 1);
assertThat(testCustomer.getNumber()).isEqualTo(UPDATED_NUMBER);
assertThat(testCustomer.getPrefix()).isEqualTo(UPDATED_PREFIX);
assertThat(testCustomer.getName()).isEqualTo(UPDATED_NAME);
assertThat(testCustomer.getContractualAddress()).isEqualTo(UPDATED_CONTRACTUAL_ADDRESS);
assertThat(testCustomer.getContractualSalutation()).isEqualTo(UPDATED_CONTRACTUAL_SALUTATION);
assertThat(testCustomer.getBillingAddress()).isEqualTo(UPDATED_BILLING_ADDRESS);
assertThat(testCustomer.getBillingSalutation()).isEqualTo(UPDATED_BILLING_SALUTATION);
}
@Test

View File

@ -21,7 +21,7 @@ describe('Service Tests', () => {
service = injector.get(CustomerService);
httpMock = injector.get(HttpTestingController);
elemDefault = new Customer(0, 0, 'AAAAAAA');
elemDefault = new Customer(0, 0, 'AAAAAAA', 'AAAAAAA', 'AAAAAAA', 'AAAAAAA', 'AAAAAAA', 'AAAAAAA');
});
describe('Service methods', async () => {
@ -56,7 +56,12 @@ describe('Service Tests', () => {
const returnedFromService = Object.assign(
{
number: 1,
prefix: 'BBBBBB'
prefix: 'BBBBBB',
name: 'BBBBBB',
contractualAddress: 'BBBBBB',
contractualSalutation: 'BBBBBB',
billingAddress: 'BBBBBB',
billingSalutation: 'BBBBBB'
},
elemDefault
);
@ -74,7 +79,12 @@ describe('Service Tests', () => {
const returnedFromService = Object.assign(
{
number: 1,
prefix: 'BBBBBB'
prefix: 'BBBBBB',
name: 'BBBBBB',
contractualAddress: 'BBBBBB',
contractualSalutation: 'BBBBBB',
billingAddress: 'BBBBBB',
billingSalutation: 'BBBBBB'
},
elemDefault
);