diff options
Diffstat (limited to 'ufund-api')
| -rw-r--r-- | ufund-api/.gitignore | 32 | ||||
| -rw-r--r-- | ufund-api/HELP.md | 22 | ||||
| -rw-r--r-- | ufund-api/pom.xml | 155 | ||||
| -rw-r--r-- | ufund-api/src/main/java/com/ufund/api/ufundapi/UfundApiApplication.java | 13 | ||||
| -rw-r--r-- | ufund-api/src/main/java/com/ufund/api/ufundapi/WebConfig.java | 16 | ||||
| -rw-r--r-- | ufund-api/src/main/resources/application.properties | 1 | ||||
| -rw-r--r-- | ufund-api/src/test/java/com/ufund/api/ufundapi/UfundApiApplicationTests.java | 13 | 
7 files changed, 252 insertions, 0 deletions
diff --git a/ufund-api/.gitignore b/ufund-api/.gitignore new file mode 100644 index 0000000..7ed0d6b --- /dev/null +++ b/ufund-api/.gitignore @@ -0,0 +1,32 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ diff --git a/ufund-api/HELP.md b/ufund-api/HELP.md new file mode 100644 index 0000000..f110fea --- /dev/null +++ b/ufund-api/HELP.md @@ -0,0 +1,22 @@ +# Read Me First +The following was discovered as part of building this project: + +* The original package name 'com.ufund.api.ufund-api' is invalid and this project uses 'com.ufund.api.ufundapi' instead. + +# Getting Started + +### Reference Documentation +For further reference, please consider the following sections: + +* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html) +* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.6.2/maven-plugin/reference/html/) +* [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.6.2/maven-plugin/reference/html/#build-image) +* [Spring Web](https://docs.spring.io/spring-boot/docs/2.6.2/reference/htmlsingle/#boot-features-developing-web-applications) + +### Guides +The following guides illustrate how to use some features concretely: + +* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/) +* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/) +* [Building REST services with Spring](https://spring.io/guides/tutorials/bookmarks/) + diff --git a/ufund-api/pom.xml b/ufund-api/pom.xml new file mode 100644 index 0000000..ce96d60 --- /dev/null +++ b/ufund-api/pom.xml @@ -0,0 +1,155 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> +	<modelVersion>4.0.0</modelVersion> +	<parent> +		<groupId>org.springframework.boot</groupId> +		<artifactId>spring-boot-starter-parent</artifactId> +		<version>3.4.2</version> +		<relativePath /> <!-- lookup parent from repository --> +	</parent> +	<groupId>com.ufund.api</groupId> +	<artifactId>ufund-api</artifactId> +	<version>0.0.1-SNAPSHOT</version> +	<name>ufund-api</name> +	<description>API for U-Fund</description> +	<properties> +		<java.version>21</java.version> +		<jacoco.version>0.8.11</jacoco.version> +		<exec.maven.version>3.5.0</exec.maven.version> +	</properties> +	<dependencies> +		<dependency> +			<groupId>org.springframework.boot</groupId> +			<artifactId>spring-boot-starter-web</artifactId> +		</dependency> + +		<dependency> +			<groupId>org.springframework.boot</groupId> +			<artifactId>spring-boot-starter-test</artifactId> +			<scope>test</scope> +		</dependency> +	</dependencies> + +	<build> +		<plugins> +			<plugin> +				<groupId>org.springframework.boot</groupId> +				<artifactId>spring-boot-maven-plugin</artifactId> +			</plugin> +			<plugin> +				<groupId>org.codehaus.mojo</groupId> +				<artifactId>exec-maven-plugin</artifactId> +				<version>${exec.maven.version}</version> +				<executions> +					<execution> +						<goals> +							<goal>java</goal> +						</goals> +					</execution> +					<execution> +						<id>tests-and-coverage</id> +						<configuration> +							<executable>mvn</executable> +							<arguments> +								<argument>clean</argument> +								<argument>test-compile</argument> +								<argument>surefire:test@controller</argument> +								<argument>jacoco:report@controller</argument> +								<argument>surefire:test@model</argument> +								<argument>jacoco:report@model</argument> +								<argument>surefire:test@persistence</argument> +								<argument>jacoco:report@persistence</argument> +							</arguments> +						</configuration> +					</execution> +				</executions> +				<configuration> +					<mainClass>com.ufund.api.ufundapi.UfundApiApplication</mainClass> +					<arguments></arguments> +				</configuration> +			</plugin> +			<plugin> +				<groupId>org.jacoco</groupId> +				<artifactId>jacoco-maven-plugin</artifactId> +				<version>${jacoco.version}</version> +				<configuration> +					<destfile>/target/coverage-reports/jacoco-unit.exec</destfile> +					<datafile>/target/coverage-reports/jacoco-unit.exec</datafile> +				</configuration> +				<executions> +					<execution> +						<id>jacoco-initialize</id> +						<configuration> +							<!-- throw away the old data with each test run --> +							<append>false</append> +						</configuration> +						<goals> +							<goal>prepare-agent</goal> +						</goals> +					</execution> +					<!-- attached to Maven test phase --> +					<execution> +						<id>report</id> +						<phase>test</phase> +						<goals> +							<goal>report</goal> +						</goals> +					</execution> +					<execution> +						<id>controller</id> +						<configuration> +							<footer>Controller Tier</footer> +							<title>U-Fund API Controller Tier Test Coverage</title> +							<outputDirectory>target/site/jacoco/controller</outputDirectory> +						</configuration> +						<goals> +							<goal>report</goal> +						</goals> +					</execution> +					<execution> +						<id>persistence</id> +						<configuration> +							<footer>Persistence Tier</footer> +							<title>U-Fund API Persistence Tier Test Coverage</title> +							<outputDirectory>target/site/jacoco/persistence</outputDirectory> +						</configuration> +						<goals> +							<goal>report</goal> +						</goals> +					</execution> +					<execution> +						<id>model</id> +						<configuration> +							<footer>Model Tier</footer> +							<title>U-Fund API Model Tier Test Coverage</title> +							<outputDirectory>target/site/jacoco/model</outputDirectory> +						</configuration> +						<goals> +							<goal>report</goal> +						</goals> +					</execution> +					<execution> +						<id>jacoco-check</id> +						<goals> +						  <goal>check</goal> +						</goals> +						<configuration> +							<rules> +							  <rule> +								  <element>BUNDLE</element> +								  <limits> +								 <limit> +								   <counter>INSTRUCTION</counter> +								   <value>COVEREDRATIO</value> +								   <minimum>0.90</minimum> +								 </limit> +							 </limits> +								 </rule> +								</rules> +					   </configuration> +			 		</execution> +				</executions> +			</plugin> +		</plugins> +	</build> +</project> diff --git a/ufund-api/src/main/java/com/ufund/api/ufundapi/UfundApiApplication.java b/ufund-api/src/main/java/com/ufund/api/ufundapi/UfundApiApplication.java new file mode 100644 index 0000000..6e263d5 --- /dev/null +++ b/ufund-api/src/main/java/com/ufund/api/ufundapi/UfundApiApplication.java @@ -0,0 +1,13 @@ +package com.ufund.api.ufundapi; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class UfundApiApplication { + +	public static void main(String[] args) { +		SpringApplication.run(UfundApiApplication.class, args); +	} + +} diff --git a/ufund-api/src/main/java/com/ufund/api/ufundapi/WebConfig.java b/ufund-api/src/main/java/com/ufund/api/ufundapi/WebConfig.java new file mode 100644 index 0000000..7d7bfa0 --- /dev/null +++ b/ufund-api/src/main/java/com/ufund/api/ufundapi/WebConfig.java @@ -0,0 +1,16 @@ +package com.ufund.api.ufundapi; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +@Configuration +@EnableWebMvc +public class WebConfig implements WebMvcConfigurer { + +    @Override +    public void addCorsMappings(CorsRegistry registry) { +        registry.addMapping("/**") +                .allowedMethods("HEAD", "GET", "PUT", "POST", "DELETE", "PATCH"); +    } +}
\ No newline at end of file diff --git a/ufund-api/src/main/resources/application.properties b/ufund-api/src/main/resources/application.properties new file mode 100644 index 0000000..3e7fc8a --- /dev/null +++ b/ufund-api/src/main/resources/application.properties @@ -0,0 +1 @@ +server.error.include-message=always diff --git a/ufund-api/src/test/java/com/ufund/api/ufundapi/UfundApiApplicationTests.java b/ufund-api/src/test/java/com/ufund/api/ufundapi/UfundApiApplicationTests.java new file mode 100644 index 0000000..fc7eda8 --- /dev/null +++ b/ufund-api/src/test/java/com/ufund/api/ufundapi/UfundApiApplicationTests.java @@ -0,0 +1,13 @@ +package com.ufund.api.ufundapi; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class UfundApiApplicationTests { + +	@Test +	void contextLoads() { +	} + +}  | 
