Skip to content

Commit b025e17

Browse files
Turn on QA
1 parent 98e846c commit b025e17

File tree

53 files changed

+190
-177
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+190
-177
lines changed

Diff for: .gitignore

+2-24
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,2 @@
1-
/target/
2-
/client-model/target/
3-
/client-rest-api/target/
4-
/client-web/target/
5-
/client-lde/target/
6-
/client-war/target/
7-
/app-api/target/
8-
/app-rest-api/target/
9-
/web-ui/target/
10-
/web-lde/target/
11-
/web-war/target/
12-
/sample-api-bdd/target/
13-
/model-api/target/
14-
/rest-api/target/
15-
/model-rest-client-impl/target/
16-
/rest-model-client-impl/target/
17-
/rest-client-model-impl/target/
18-
/model-bdd/target/
19-
/model-mock-impl/target/
20-
/rest-server-impl/target/
21-
/app-bom/target/
22-
/app-lde/target/
23-
/app-war/target/
24-
/web-bom/target/
1+
local_app.properties
2+
target/

Diff for: app-bom/src/main/resources/bordertech-app.properties

-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,2 @@
1-
## CORE Business Implementation
2-
##bordertech.factory.impl.au.gov.border.attachviewer.api.service.AttachmentRetriever=au.gov.border.core.business.AttachmentRetrieverCoreImpl
3-
##bordertech.factory.impl.au.gov.border.attachviewer.api.service.ApplicationRetriever=au.gov.border.core.business.ApplicationRetrieverCoreImpl
4-
##bordertech.factory.impl.au.gov.border.attachviewer.api.service.AdminService=au.gov.border.core.business.AdminServiceCoreImpl
5-
##bordertech.factory.impl.au.gov.border.attachviewer.api.service.HealthCheckService=au.gov.border.core.business.HealthCheckServiceImpl
6-
71
## Environment
82
bordertech.config.environment=MOCK
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## Add local_app property files to Bordertech CONFIG mechanism
2+
bordertech.config.resource.order=bordertech-defaults.properties\
3+
,bordertech-app.properties\
4+
,bordertech-local.properties\
5+
,local_app.properties

Diff for: app-lde/example_local_app.properties

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## TOMCAT Settings
2+
##bordertech.lde.port.default=8082
3+
4+
## MOCK Environment
5+
##bordertech.config.environment=MOCK
6+

Diff for: app-lde/src/main/java/com/sample/app/server/lde/LdeAppLauncherProxy.java renamed to app-lde/src/main/java/com/sample/app/server/lde/DemoLauncherProxy.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
/**
66
* Start Tomcat Server.
77
*/
8-
public final class LdeAppLauncherProxy {
8+
@SuppressWarnings("HideUtilityClassConstructor")
9+
public final class DemoLauncherProxy {
910

1011
public static void main(final String[] args) {
1112
LdeLauncher.launchServer();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/**
2+
* Launch LDE.
3+
*/
4+
package com.sample.app.server.lde;

Diff for: model-mock-impl/src/main/java/com/sample/app/model/impl/MockDataUtil.java

+55-17
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import com.sample.app.model.client.DocumentContent;
77
import com.sample.app.model.client.DocumentDetail;
88
import com.sample.app.model.client.StateType;
9-
import com.sample.app.model.exception.ServiceException;
109
import java.io.InputStream;
1110
import java.text.DecimalFormat;
1211
import java.util.ArrayList;
@@ -21,7 +20,7 @@
2120
/**
2221
* Mock implementation for testing.
2322
*/
24-
public class MockDataUtil {
23+
public final class MockDataUtil {
2524

2625
private static final AtomicInteger CLIENT_IDS = new AtomicInteger(1);
2726
private static final Map<String, ClientDetail> CLIENTS = new HashMap<>();
@@ -37,16 +36,35 @@ public class MockDataUtil {
3736

3837
}
3938

39+
/**
40+
* Private constructor.
41+
*/
42+
private MockDataUtil() {
43+
// Do nothing
44+
}
45+
46+
/**
47+
* @return the list of available table names
48+
*/
4049
public static List<String> retrieveTableNames() {
4150
return new ArrayList<>(TABLES.keySet());
4251
}
4352

53+
/**
54+
* @param table the table name
55+
* @return the code options for the table
56+
*/
4457
public static List<CodeOption> retrieveTableCodes(final String table) {
4558
List<CodeOption> options = TABLES.get(table);
4659
return options;
4760
}
4861

49-
public static List<ClientDetail> searchClients(final String search) throws ServiceException {
62+
/**
63+
*
64+
* @param search the search criteria
65+
* @return the matching clients
66+
*/
67+
public static List<ClientDetail> searchClients(final String search) {
5068

5169
List<ClientDetail> clients = new ArrayList<>();
5270

@@ -60,28 +78,50 @@ public static List<ClientDetail> searchClients(final String search) throws Servi
6078
return clients;
6179
}
6280

81+
/**
82+
*
83+
* @param clientId the client id to retrieve
84+
* @return the client details
85+
*/
6386
public static ClientDetail retrieveClient(final String clientId) {
6487
return CLIENTS.get(clientId);
6588
}
6689

67-
public static ClientDetail createClient(final ClientDetail detail) throws ServiceException {
90+
/**
91+
*
92+
* @param detail the client details to create
93+
* @return the created client
94+
*/
95+
public static ClientDetail createClient(final ClientDetail detail) {
6896
String id = "ORG" + CLIENT_IDS.getAndIncrement();
6997
detail.setClientId(id);
7098
CLIENTS.put(id, detail);
7199
return detail;
72100
}
73101

74-
public static ClientDetail updateClient(final ClientDetail detail) throws ServiceException {
102+
/**
103+
* @param detail the updated client details
104+
* @return the client details
105+
*/
106+
public static ClientDetail updateClient(final ClientDetail detail) {
75107
String key = detail.getClientId();
76108
CLIENTS.put(key, detail);
77109
return detail;
78110
}
79111

80-
public static void deleteClient(final String clientId) throws ServiceException {
112+
/**
113+
*
114+
* @param clientId the client id to delete
115+
*/
116+
public static void deleteClient(final String clientId) {
81117
CLIENTS.remove(clientId);
82118
// TODO Remove documents as well
83119
}
84120

121+
/**
122+
* @param clientId the client id to retrieve documents for
123+
* @return the list of client documents
124+
*/
85125
public static List<DocumentDetail> getOrCreateClientDocuments(final String clientId) {
86126
// Build mock list of document details
87127
List<DocumentDetail> docs = CLIENT_DOCUMENTS.get(clientId);
@@ -95,10 +135,19 @@ public static List<DocumentDetail> getOrCreateClientDocuments(final String clien
95135
return docs;
96136
}
97137

138+
/**
139+
* @param documentId the document id to retrieve
140+
* @return the document details
141+
*/
98142
public static DocumentDetail retrieveDocument(final String documentId) {
99143
return DOCUMENTS.get(documentId);
100144
}
101145

146+
/**
147+
*
148+
* @param doc the document content to retrieve
149+
* @return the document content
150+
*/
102151
public static DocumentContent retrieveContent(final DocumentDetail doc) {
103152
byte[] bytes = getDocumentBytes(doc);
104153
String mime = getDocumentMimeType(doc);
@@ -126,10 +175,6 @@ private static Map<String, List<CodeOption>> createTables() {
126175
return tables;
127176
}
128177

129-
/**
130-
* @param idx the suffix
131-
* @return the detail
132-
*/
133178
private static ClientDetail createOrganisation(final int idx) {
134179
ClientDetail detail = new ClientDetail();
135180
detail.setClientId("ORG" + idx);
@@ -140,10 +185,6 @@ private static ClientDetail createOrganisation(final int idx) {
140185
return detail;
141186
}
142187

143-
/**
144-
* @param idx the suffix
145-
* @return the detail
146-
*/
147188
private static AddressDetail createAddress(final int idx) {
148189
AddressDetail detail = new AddressDetail();
149190
detail.setCountryCode("A");
@@ -154,9 +195,6 @@ private static AddressDetail createAddress(final int idx) {
154195
return detail;
155196
}
156197

157-
/**
158-
* @return the mock documents
159-
*/
160198
private static List<DocumentDetail> createDocuments(final String clientId) {
161199
// Build mock list of document details
162200
List<DocumentDetail> docs = new ArrayList<>();

Diff for: pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<packaging>pom</packaging>
1212

1313
<properties>
14-
<bt.qa.skip>true</bt.qa.skip>
14+
<bt.qa.skip>false</bt.qa.skip>
1515
<!-- OWASP -->
1616
<dependency-check.skip>false</dependency-check.skip>
1717
<!-- Report Vulnerabilities. -->

Diff for: rest-api/src/main/java/com/sample/app/rest/api/v1/ClientServicesResource.java

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
})
3939
@Consumes(MediaType.APPLICATION_JSON)
4040
@Produces(MediaType.APPLICATION_JSON)
41+
@SuppressWarnings("NoWhitespaceBefore")
4142
public interface ClientServicesResource {
4243

4344
/**

Diff for: rest-client-model-impl/pom.xml

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<description>REST API Client Implementation</description>
1919

2020
<properties>
21+
<checkstyle.excludes>com/sample/app/rest/client/jersey/**/*</checkstyle.excludes>
2122
<spotbugs.excludeFilterFile>${basedir}/spotbugs-exclude-files.xml</spotbugs.excludeFilterFile>
2223
</properties>
2324

@@ -83,6 +84,7 @@
8384

8485
<build>
8586
<plugins>
87+
8688
<!-- Unpack the swagger JSON -->
8789
<plugin>
8890
<groupId>org.apache.maven.plugins</groupId>
@@ -206,7 +208,7 @@
206208
<artifactId>maven-pmd-plugin</artifactId>
207209
<configuration>
208210
<excludes>
209-
<exclude>**/com/restfriends/sample/rest/client/jersey/**</exclude>
211+
<exclude>**/com/sample/app/rest/client/jersey/**</exclude>
210212
</excludes>
211213
</configuration>
212214
</plugin>

Diff for: rest-client-model-impl/spotbugs-exclude-files.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<!-- Exclude generated files -->
55
<Match>
6-
<Package name="~com\.restfriends\.sample\.rest\.client\.jersey\..*"/>
6+
<Package name="~com\.sample\.app\.rest\.client\.jersey\..*"/>
77
</Match>
88

99
</FindBugsFilter>

Diff for: rest-client-model-impl/src/main/java/com/sample/app/rest/client/v1/helper/DefaultApiClient.java

+10-1
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,16 @@ public class DefaultApiClient extends ApiClient {
1919

2020
private static final String AV_REST_URI = "sample.rest.uri";
2121

22+
/**
23+
* @return the REST URI endpoint
24+
*/
2225
public static String getRestUri() {
2326
return Config.getInstance().getString(AV_REST_URI, "http://localhost:8082/lde/api");
2427
}
2528

29+
/**
30+
* Default constructor.
31+
*/
2632
public DefaultApiClient() {
2733
setBasePath(getRestUri());
2834
ObjectMapper mapper = json.getContext(null);
@@ -33,7 +39,10 @@ public DefaultApiClient() {
3339
}
3440

3541
@Override
36-
public <T> ApiResponse<T> invokeAPI(final String path, final String method, final List<Pair> queryParams, final Object body, final Map<String, String> headerParams, final Map<String, Object> formParams, final String accept, String contentType, final String[] authNames, final GenericType<T> returnType) throws ApiException {
42+
public <T> ApiResponse<T> invokeAPI(final String path, final String method, final List<Pair> queryParams,
43+
final Object body, final Map<String, String> headerParams, final Map<String, Object> formParams,
44+
final String accept, final String contentType, final String[] authNames, final GenericType<T> returnType)
45+
throws ApiException {
3746
Object fixBody = body;
3847
// Pass a Empty String instead of NULL Body
3948
if ("PUT".equals(method) && body == null) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/**
2+
* REST API Helpers.
3+
*/
4+
package com.sample.app.rest.client.v1.helper;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/**
2+
* REST Client MODEL implementations.
3+
*/
4+
package com.sample.app.rest.client.v1;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/**
2+
* Client REST resource implementations.
3+
*/
4+
package com.sample.app.rest.server.v1;

Diff for: rest-server-impl/src/main/java/com/sample/app/rest/servlet/ClientRestApplication.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import com.sample.app.rest.server.v1.ClientServicesResourceImpl;
66

77
/**
8-
* Client REST Swagger/Jersey Application.
8+
* ClientREST Swagger/Jersey Application.
99
*/
1010
public class ClientRestApplication extends SwaggerRestApplication {
1111

Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
/**
2-
* Client REST servlet details.
2+
* Client REST Servlet details.
33
*/
44
package com.sample.app.rest.servlet;

Diff for: web-bom/src/main/resources/bordertech-app.properties

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
## Environment
33
## Mock - Default to MOCK Environment for SAMPLE
44
bordertech.config.environment=MOCK
5+
56
## Local REST Server - CAn be used to call an instance of the REST Server running
67
##bordertech.config.environment=LOCAL
78
## Can override this method if want to change default end point
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## Add WComponent property files to Bordertech CONFIG mechanism
2+
bordertech.config.resource.order=bordertech-defaults.properties\
3+
,bordertech-app.properties\
4+
,bordertech-local.properties\
5+
,wcomponents.properties\
6+
,wcomponents-app.properties\
7+
,local_app.properties

Diff for: web-lde/example_local_app.properties

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
### To prevent whitespace from being removed from the rendered html pages.
2-
#bordertech.wcomponents.whitespaceFilter.enabled=false
3-
4-
#bordertech.wcomponents.debug.enabled = true
5-
#bordertech.wcomponents.debug.clientSide.enabled = true
6-
7-
#bordertech.wcomponents.lde.server.port=8085
1+
## TOMCAT Settings
2+
##bordertech.lde.port.default=8081
3+
4+
## MOCK Environment
5+
##bordertech.config.environment=MOCK
6+

Diff for: web-lde/src/main/java/com/sample/app/client/lde/DemoLauncherProxy.java

-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44

55
/**
66
* Start Tomcat Server.
7-
*
8-
* @author Jonathan Austin
9-
* @since 1.0.0
107
*/
118
@SuppressWarnings("HideUtilityClassConstructor")
129
public final class DemoLauncherProxy {

0 commit comments

Comments
 (0)