You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: The `-DskipTests=true` option is used to skip the tests. The tests require the application to be running.
45
45
46
-
Note: The application is tested with Java 17. If you are using a different version of Java, please update the `pom.xml` file accordingly.
46
+
Note: The application is tested with Java 11. If you are using a different version of Java, please update the `pom.xml` file accordingly.
47
47
48
48
### Setup Database Configuration
49
49
@@ -54,7 +54,9 @@ Specifically, you need to do the following:
54
54
- Create the [database credentials](https://docs.couchbase.com/cloud/clusters/manage-database-users.html) to access the travel-sample bucket (Read and Write) used in the application.
55
55
-[Allow access](https://docs.couchbase.com/cloud/clusters/allow-ip-address.html) to the Cluster from the IP on which the application is running.
56
56
57
-
All configuration for communication with the database is read from the environment variables. We have provided a convenience feature in this quickstart to read the environment variables from a local file, `application.properties` in the `src/main/resources` folder.
57
+
All configuration for communication with the database is read from the application properties. We have provided a convenience feature in this quickstart to read the properties from a local file, `application.properties` in the `src/main/resources` folder.
58
+
59
+
You can also use your system environment variables to set the properties. The properties are read from the environment variables if they are set. The properties are read from the `application.properties` file if the environment variables are not set.
Note: The `application.properties` file has the connection information to connect to your Capella cluster. These will be part of the environment variables in the Docker container.
97
+
Note: The `application.properties` file has the connection information to connect to your Capella cluster. You can also pass the connection information as environment variables to the Docker container.
98
+
If you choose not to pass the environment variables, you can update the `application.properties` file in the `src/main/resources` folder.
97
99
98
100
### Verifying the Application
99
101
100
102
Once the application starts, you can see the details of the application on the logs.
The application will run on port 8080 of your local machine (http://localhost:8080). You will find the interactive Swagger documentation of the API if you go to the URL in your browser. Swagger documentation is used in this demo to showcase the different API endpoints and how they can be invoked. More details on the Swagger documentation can be found in the [appendix](#swagger-documentation).
To run the integration tests, use the following commands:
111
+
To test your application, you can use Maven (mvn) to run the test suite. Here are the steps to run the tests:
112
+
113
+
### Run All Tests:
114
+
115
+
```sh
116
+
mvn test
117
+
```
118
+
119
+
This command will execute all the test cases in your project.
120
+
121
+
### Run Individual Tests:
122
+
123
+
Additionally, you can run individual test classes or methods using the following commands:
124
+
125
+
To run the tests for the AirlineIntegrationTest class:
111
126
112
127
```sh
113
128
mvn test -Dtest=org.couchbase.quickstart.springboot.controllers.AirlineIntegrationTest
129
+
```
130
+
131
+
To run the tests for the AirportIntegrationTest class:
132
+
133
+
```sh
114
134
mvn test -Dtest=org.couchbase.quickstart.springboot.controllers.AirportIntegrationTest
115
-
mvn test -Dtest=org.couchbase.quickstart.springboot.controllers.RouteIntegrationTest
135
+
```
116
136
117
-
You can also run all the tests using the following command:
118
-
mvn test
137
+
To run the tests for the RouteIntegrationTest class:
138
+
139
+
```sh
140
+
mvn test -Dtest=org.couchbase.quickstart.springboot.controllers.Rout
119
141
```
120
142
121
143
## Appendix
@@ -124,16 +146,16 @@ mvn test
124
146
125
147
For this quickstart, we use three collections, `airport`, `airline` and `routes` that contain sample airports, airlines and airline routes respectively. The routes collection connects the airports and airlines as seen in the figure below. We use these connections in the quickstart to generate airports that are directly connected and airlines connecting to a destination airport. Note that these are just examples to highlight how you can use SQL++ queries to join the collections.
126
148
127
-

149
+

128
150
129
151
### Extending API by Adding New Entity
130
152
131
153
If you would like to add another entity to the APIs, these are the steps to follow:
132
154
133
-
- Create the new entity (collection) in the Couchbase bucket. You can create the collection using the [SDK](https://docs.couchbase.com/java-sdk/current/howtos/provisioning-cluster-resources.html#collection-management) or via the [Couchbase Server interface](https://docs.couchbase.com/cloud/n1ql/n1ql-language-reference/createcollection.html).
134
-
- Define the routes in a new file in the `controllers`folder similar to the existing routes like `AirportController.java`.
135
-
- Define the service in a new file in the `services`folder similar to the existing services like `AirportService.java`. You'll have to implement the service interface `AirportServiceImpl.java`.
136
-
- Define the repository in a new file in the `repositories`folder similar to the existing repositories like `AirportRepository.java`. You'll have to implement the repository interface `AirportRepositoryImpl.java`.
155
+
- Create the new entity (collection) in the Couchbase scope. You can create the collection using the [SDK](https://docs.couchbase.com/java-sdk/current/howtos/provisioning-cluster-resources.html#collection-management) or via the [Couchbase Server interface](https://docs.couchbase.com/cloud/n1ql/n1ql-language-reference/createcollection.html).
156
+
- Define the routes in a new class in the `controllers`package similar to the existing routes like `AirportController.java`.
157
+
- Define the service in a new class in the `services`package similar to the existing services like `AirportService.java`. You'll have to implement the service interface `AirportServiceImpl.java`.
158
+
- Define the repository in a new class in the `repositories`package similar to the existing repositories like `AirportRepository.java`. You'll have to implement the repository interface `AirportRepositoryImpl.java`.
0 commit comments