Skip to content

Commit fea8bd2

Browse files
committed
ClientCreatePageUITest
1 parent c5901ea commit fea8bd2

6 files changed

Lines changed: 61 additions & 112 deletions

File tree

pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@
2828
<junit.version>4.12</junit.version>
2929
<!-- allowed values: R7, 1.0, 1.5, 2.0 or none -->
3030
<wtp.version>none</wtp.version>
31-
<frmk.version>2.2.6-SNAPSHOT</frmk.version>
32-
<guava.version>24.1-jre</guava.version>
33-
<spring.version>5.0.5.RELEASE</spring.version>
34-
<spring.integration.version>5.0.4.RELEASE</spring.integration.version>
31+
<frmk.version>2.2.7</frmk.version>
32+
<guava.version>25.0-jre</guava.version>
33+
<spring.version>5.0.6.RELEASE</spring.version>
34+
<spring.integration.version>5.0.5.RELEASE</spring.integration.version>
3535
<mysql.version>5.1.46</mysql.version>
3636
<commons-dbcp2.version>2.2.0</commons-dbcp2.version>
3737
<configuration.version>1.10</configuration.version>
3838
<jasypt.version>1.9.2</jasypt.version>
39-
<selenium.version>3.5.2</selenium.version>
39+
<selenium.version>3.12.0</selenium.version>
4040
<gson.version>2.8.4</gson.version>
4141
<unirest-java.version>2.2.03</unirest-java.version>
4242
<commons-lang3.version>3.7</commons-lang3.version>

src/main/java/com/angkorteam/fintech/Application.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import com.angkorteam.fintech.pages.client.client.ClientBrowsePage;
2424
import com.angkorteam.framework.ReferenceUtilities;
2525
import com.angkorteam.framework.ResourceScope;
26+
import com.angkorteam.framework.SpringBean;
2627
import com.google.common.collect.Maps;
2728

2829
/**
@@ -42,6 +43,8 @@ public class Application extends AuthenticatedWebApplication {
4243
@Override
4344
protected void init() {
4445
super.init();
46+
XMLPropertiesConfiguration configuration = SpringBean.getBean(XMLPropertiesConfiguration.class);
47+
4548
IPackageResourceGuard packageResourceGuard = this.getResourceSettings().getPackageResourceGuard();
4649
if (packageResourceGuard instanceof SecurePackageResourceGuard) {
4750
SecurePackageResourceGuard guard = (SecurePackageResourceGuard) packageResourceGuard;
@@ -51,8 +54,12 @@ protected void init() {
5154
getJavaScriptLibrarySettings().setJQueryReference(new PackageResourceReference(ResourceScope.class, ReferenceUtilities.J_QUERY_JS));
5255
mountPage("/simulator", SimulatorPage.class);
5356

54-
IRequestMapper cryptoMapper = new CryptoMapper(getRootRequestMapper(), this);
55-
setRootRequestMapper(cryptoMapper);
57+
RuntimeConfigurationType configurationType = RuntimeConfigurationType.valueOf(configuration.getString("wicket"));
58+
59+
if (configurationType == RuntimeConfigurationType.DEPLOYMENT) {
60+
IRequestMapper cryptoMapper = new CryptoMapper(getRootRequestMapper(), this);
61+
setRootRequestMapper(cryptoMapper);
62+
}
5663

5764
getMarkupSettings().setStripWicketTags(true);
5865
}

src/main/java/com/angkorteam/fintech/pages/client/client/ClientCreatePage.java

Lines changed: 4 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,10 @@
2323
import com.angkorteam.fintech.Page;
2424
import com.angkorteam.fintech.Session;
2525
import com.angkorteam.fintech.ddl.MOffice;
26-
import com.angkorteam.fintech.ddl.MSavingsProduct;
2726
import com.angkorteam.fintech.ddl.MStaff;
2827
import com.angkorteam.fintech.dto.Function;
2928
import com.angkorteam.fintech.dto.builder.ClientBuilder;
3029
import com.angkorteam.fintech.dto.builder.FamilyMemberBuilder;
31-
import com.angkorteam.fintech.dto.enums.DepositType;
3230
import com.angkorteam.fintech.dto.enums.LegalForm;
3331
import com.angkorteam.fintech.helper.ClientHelper;
3432
import com.angkorteam.fintech.layout.Size;
@@ -222,24 +220,6 @@ public class ClientCreatePage extends Page {
222220
protected Date submittedOnValue;
223221
protected DateTextField submittedOnField;
224222

225-
protected UIRow row12;
226-
227-
protected UIBlock externalIdBlock;
228-
protected UIContainer externalIdIContainer;
229-
protected String externalIdValue;
230-
protected TextField<String> externalIdField;
231-
232-
protected UIBlock openSavingsAccountBlock;
233-
protected UIContainer openSavingsAccountIContainer;
234-
protected Boolean openSavingsAccountValue;
235-
protected CheckBox openSavingsAccountField;
236-
237-
protected UIBlock savingsAccountBlock;
238-
protected UIContainer savingsAccountIContainer;
239-
protected SingleChoiceProvider savingsAccountProvider;
240-
protected Option savingsAccountValue;
241-
protected Select2SingleChoice<Option> savingsAccountField;
242-
243223
protected UIRow row13;
244224

245225
protected UIBlock familyMemberBlock;
@@ -425,7 +405,7 @@ protected void initComponent() {
425405
this.remarkIContainer.add(this.remarkField);
426406
this.remarkIContainer.newFeedback("remarkFeedback", this.remarkField);
427407

428-
this.row10Block1 = this.row10.newUIBlock("row10lock1", Size.Six_6);
408+
this.row10Block1 = this.row10.newUIBlock("row10Block1", Size.Six_6);
429409

430410
this.row11 = UIRow.newUIRow("row11", this.form);
431411

@@ -447,26 +427,6 @@ protected void initComponent() {
447427
this.submittedOnIContainer.add(this.submittedOnField);
448428
this.submittedOnIContainer.newFeedback("submittedOnFeedback", this.submittedOnField);
449429

450-
this.row12 = UIRow.newUIRow("row12", this.form);
451-
452-
this.openSavingsAccountBlock = this.row12.newUIBlock("openSavingsAccountBlock", Size.Four_4);
453-
this.openSavingsAccountIContainer = this.openSavingsAccountBlock.newUIContainer("openSavingsAccountIContainer");
454-
this.openSavingsAccountField = new CheckBox("openSavingsAccountField", new PropertyModel<>(this, "openSavingsAccountValue"));
455-
this.openSavingsAccountIContainer.add(this.openSavingsAccountField);
456-
this.openSavingsAccountIContainer.newFeedback("openSavingsAccountFeedback", this.openSavingsAccountField);
457-
458-
this.externalIdBlock = this.row12.newUIBlock("externalIdBlock", Size.Four_4);
459-
this.externalIdIContainer = this.externalIdBlock.newUIContainer("externalIdIContainer");
460-
this.externalIdField = new TextField<>("externalIdField", new PropertyModel<>(this, "externalIdValue"));
461-
this.externalIdIContainer.add(this.externalIdField);
462-
this.externalIdIContainer.newFeedback("externalIdFeedback", this.externalIdField);
463-
464-
this.savingsAccountBlock = this.row12.newUIBlock("savingsAccountBlock", Size.Four_4);
465-
this.savingsAccountIContainer = this.savingsAccountBlock.newUIContainer("savingsAccountIContainer");
466-
this.savingsAccountField = new Select2SingleChoice<>("savingsAccountField", new PropertyModel<>(this, "savingsAccountValue"), this.savingsAccountProvider);
467-
this.savingsAccountIContainer.add(this.savingsAccountField);
468-
this.savingsAccountIContainer.newFeedback("savingsAccountFeedback", this.savingsAccountField);
469-
470430
this.row13 = UIRow.newUIRow("row13", this.form);
471431

472432
this.familyMemberBlock = this.row13.newUIBlock("familyMemberBlock", Size.Twelve_12);
@@ -487,7 +447,6 @@ protected void initComponent() {
487447
@Override
488448
protected void initData() {
489449
StringGenerator generator = SpringBean.getBean(StringGenerator.class);
490-
this.externalIdValue = generator.externalId();
491450
this.popupModel = Maps.newHashMap();
492451

493452
this.officeProvider = new SingleChoiceProvider(MOffice.NAME, MOffice.Field.ID, MOffice.Field.NAME);
@@ -507,9 +466,6 @@ protected void initData() {
507466

508467
this.constitutionProvider = new ConstitutionProvider();
509468

510-
this.savingsAccountProvider = new SingleChoiceProvider(MSavingsProduct.NAME, MSavingsProduct.Field.ID, MSavingsProduct.Field.NAME);
511-
this.savingsAccountProvider.applyWhere("deposit_type_enum", MSavingsProduct.Field.DEPOSIT_TYPE_ENUM + " = " + DepositType.Saving.getLiteral());
512-
513469
this.familyMemberColumn = Lists.newLinkedList();
514470
this.familyMemberColumn.add(new TextColumn(Model.of("Relationship"), "relationship", "relationship", this::familyMemberColumn));
515471
this.familyMemberColumn.add(new TextColumn(Model.of("First Name"), "firstName", "firstName", this::familyMemberColumn));
@@ -532,13 +488,6 @@ protected void initData() {
532488

533489
@Override
534490
protected void configureMetaData() {
535-
this.savingsAccountField.setLabel(Model.of("Savings Account"));
536-
this.savingsAccountField.add(new OnChangeAjaxBehavior());
537-
538-
this.externalIdField.setLabel(Model.of("External ID"));
539-
this.externalIdField.add(new OnChangeAjaxBehavior());
540-
541-
this.openSavingsAccountField.add(new OnChangeAjaxBehavior(this::openSavingsAccountFieldUpdate));
542491

543492
this.submittedOnField.setLabel(Model.of("Submitted On"));
544493
this.submittedOnField.add(new OnChangeAjaxBehavior());
@@ -607,7 +556,6 @@ protected void configureMetaData() {
607556
legalFormFieldUpdate(null);
608557
officeFieldUpdate(null);
609558
activeFieldUpdate(null);
610-
openSavingsAccountFieldUpdate(null);
611559
}
612560

613561
protected boolean familyMemberAddLinkClick(AjaxLink<Void> link, AjaxRequestTarget target) {
@@ -670,15 +618,6 @@ protected void modalWindowClose(String popupName, String signalId, AjaxRequestTa
670618
target.add(this.familyMemberTable);
671619
}
672620

673-
protected boolean openSavingsAccountFieldUpdate(AjaxRequestTarget target) {
674-
boolean visible = this.openSavingsAccountValue == null ? false : this.openSavingsAccountValue;
675-
this.savingsAccountIContainer.setVisible(visible);
676-
if (target != null) {
677-
target.add(this.savingsAccountBlock);
678-
}
679-
return false;
680-
}
681-
682621
protected boolean activeFieldUpdate(AjaxRequestTarget target) {
683622
boolean visible = this.activeValue == null ? false : this.activeValue;
684623
this.activationDateIContainer.setVisible(visible);
@@ -745,6 +684,8 @@ protected boolean legalFormFieldUpdate(AjaxRequestTarget target) {
745684
}
746685

747686
protected void saveButtonSubmit(Button button) {
687+
StringGenerator generator = SpringBean.getBean(StringGenerator.class);
688+
748689
LegalForm legalForm = null;
749690
if (this.legalFormValue != null) {
750691
legalForm = LegalForm.valueOf(this.legalFormValue.getId());
@@ -785,15 +726,12 @@ protected void saveButtonSubmit(Button button) {
785726
if (this.clientTypeValue != null) {
786727
builder.withClientTypeId(this.clientTypeValue.getId());
787728
}
788-
builder.withExternalId(this.externalIdValue);
729+
builder.withExternalId(generator.externalId());
789730
boolean active = this.activeValue == null ? false : this.activeValue;
790731
if (active) {
791732
builder.withActivationDate(this.activationDateValue);
792733
}
793734
builder.withActive(active);
794-
if (this.openSavingsAccountValue != null && this.openSavingsAccountValue) {
795-
builder.withSavingsProductId(this.savingsAccountValue.getId());
796-
}
797735
builder.withSubmittedOnDate(this.submittedOnValue);
798736

799737
for (Map<String, Object> item : this.familyMemberValue) {

src/main/resources/com/angkorteam/fintech/pages/client/client/ClientCreatePage.html

Lines changed: 8 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,14 @@ <h3 class="box-title">Client Create</h3>
204204
</div>
205205

206206
<div wicket:id="row11">
207+
<div wicket:id="submittedOnBlock" class="form-group">
208+
<wicket:container wicket:id="submittedOnIContainer">
209+
<label wicket:for="submittedOnField">Submitted On</label>
210+
<input wicket:id="submittedOnField" type="text"
211+
class="form-control" />
212+
<span wicket:id="submittedOnFeedback" class="help-block"></span>
213+
</wicket:container>
214+
</div>
207215
<div wicket:id="activeBlock" class="form-group">
208216
<wicket:container wicket:id="activeIContainer">
209217
<label>&nbsp;</label>
@@ -222,44 +230,6 @@ <h3 class="box-title">Client Create</h3>
222230
<span wicket:id="activationDateFeedback" class="help-block"></span>
223231
</wicket:container>
224232
</div>
225-
<div wicket:id="submittedOnBlock" class="form-group">
226-
<wicket:container wicket:id="submittedOnIContainer">
227-
<label wicket:for="submittedOnField">Submitted On</label>
228-
<input wicket:id="submittedOnField" type="text"
229-
class="form-control" />
230-
<span wicket:id="submittedOnFeedback" class="help-block"></span>
231-
</wicket:container>
232-
</div>
233-
</div>
234-
235-
<div wicket:id="row12">
236-
<div wicket:id="openSavingsAccountBlock" class="form-group">
237-
<wicket:container wicket:id="openSavingsAccountIContainer">
238-
<label>&nbsp;</label>
239-
<span style="display: block"> <label> <input
240-
type="checkbox" wicket:id="openSavingsAccountField">
241-
Open Savings Account ?
242-
</label>
243-
</span>
244-
<span wicket:id="openSavingsAccountFeedback" class="help-block"></span>
245-
</wicket:container>
246-
</div>
247-
<div wicket:id="savingsAccountBlock" class="form-group">
248-
<wicket:container wicket:id="savingsAccountIContainer">
249-
<label wicket:for="savingsAccountField">Select Savings
250-
Account</label>
251-
<select wicket:id="savingsAccountField" class="form-control"></select>
252-
<span wicket:id="savingsAccountFeedback" class="help-block"></span>
253-
</wicket:container>
254-
</div>
255-
<div wicket:id="externalIdBlock" class="form-group">
256-
<wicket:container wicket:id="externalIdIContainer">
257-
<label wicket:for="externalIdField">External ID</label>
258-
<input wicket:id="externalIdField" type="text"
259-
class="form-control" />
260-
<span wicket:id="externalIdFeedback" class="help-block"></span>
261-
</wicket:container>
262-
</div>
263233
</div>
264234

265235
<div wicket:id="row13">

src/test/java/com/angkorteam/fintech/Start.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
package com.angkorteam.fintech;
22

3+
import java.io.File;
34
import java.lang.management.ManagementFactory;
45
import java.security.NoSuchAlgorithmException;
56
import java.security.UnrecoverableKeyException;
67

78
import javax.management.MBeanServer;
89

10+
import org.apache.wicket.WicketRuntimeException;
911
import org.eclipse.jetty.jmx.MBeanContainer;
1012
import org.eclipse.jetty.server.HttpConfiguration;
1113
import org.eclipse.jetty.server.HttpConnectionFactory;
@@ -34,7 +36,12 @@ public class Start {
3436
*/
3537
public static void main(String[] args) throws UnrecoverableKeyException, NoSuchAlgorithmException, Exception {
3638

37-
System.setProperty("javax.net.ssl.trustStore", "/opt/jdk1.8.0_172/jre/lib/security/cacerts");
39+
String javaHome = System.getenv("JAVA_HOME");
40+
if (javaHome == null || "".equals(javaHome)) {
41+
throw new WicketRuntimeException("JAVA_HOME is not define");
42+
}
43+
File cacertFile = new File(javaHome, "jre/lib/security/cacerts");
44+
System.setProperty("javax.net.ssl.trustStore", cacertFile.getAbsolutePath());
3845
System.setProperty("javax.net.ssl.trustStorePassowrd", "changeit");
3946

4047
System.setProperty("wicket.configuration", "development");
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.angkorteam.fintech.pages.client.client;
2+
3+
import org.junit.Before;
4+
import org.junit.Test;
5+
6+
import com.angkorteam.fintech.junit.JUnit;
7+
import com.angkorteam.fintech.junit.JUnitWicketTester;
8+
9+
public class ClientCreatePageUITest {
10+
11+
private JUnitWicketTester wicket;
12+
13+
@Before
14+
public void before() {
15+
this.wicket = JUnit.getWicket();
16+
}
17+
18+
@Test
19+
public void pageVisit() {
20+
this.wicket.login();
21+
22+
ClientCreatePage page = this.wicket.startPage(ClientCreatePage.class);
23+
24+
this.wicket.assertRenderedPage(ClientCreatePage.class);
25+
}
26+
27+
}

0 commit comments

Comments
 (0)