jgdsn / jcroft Goto Github PK
View Code? Open in Web Editor NEWThe new AG DSN management system
License: Apache License 2.0
The new AG DSN management system
License: Apache License 2.0
Add an importer for default permissions.
Create maven structure
Maybe it will be nice if we integrate spring metrics as monitoring.
https://spring.io/blog/2018/03/16/micrometer-spring-boot-2-s-new-application-metrics-collector
Add a power permission system, so active members cannot edit roots and so on.
Add documentation for ldap port forwarding
Get groups from ldap server.
Solve current sonarcloud quality issues.
Requires #12 .
Add stakeholders to documentation.
Create JUnit test for class User.
Currently, LDAP DN is hardcoded. We should make this option configurable in settings/jcroft.cfg .
Integrate Angular.
Fix cuberta maven plugin for codecov.io .
Add junit tests for repositories.
Like pycroft we should import finance data directly from bank accounts.
Integrate PostGreSQL.
LDAP login
I got some help from zordan (a software architect), he corrected some things, so Spring JPA / Hibernate JUnit Tests runs correctly with JUnit 5:
Corrected pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.agdsn</groupId>
<artifactId>jcroft</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<name>JCroft</name>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.3.RELEASE</version>
</parent>
<properties>
<!-- Java version -->
<java.version>1.8</java.version>
<!-- JUnit version -->
<junit5.version>5.2.0</junit5.version>
<mockito.version>2.2.7</mockito.version>
<jacoco.reportPath>${project.basedir}/../target/jacoco.exec</jacoco.reportPath>
<!-- Sonar properties-->
<sonar.jacoco.itReportPath>${project.basedir}/../target/jacoco-it.exec</sonar.jacoco.itReportPath>
<sonar.jacoco.reportPath>${project.basedir}/../target/jacoco.exec</sonar.jacoco.reportPath>
<sonar.language>java</sonar.language>
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<!-- file encoding -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<!-- tag::security[] -->
<dependencies>
<!-- JUnit -->
<!--<dependency>-->
<!--<groupId>org.junit.jupiter</groupId>-->
<!--<artifactId>junit-jupiter-api</artifactId>-->
<!--<version>${junit5.version}</version>-->
<!--<scope>test</scope>-->
<!--</dependency>-->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit5.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${junit5.version}</version>
<scope>test</scope>
</dependency>
<!--<dependency>-->
<!--<groupId>org.junit.platform</groupId>-->
<!--<artifactId>junit-platform-launcher</artifactId>-->
<!--<version>1.1.0</version>-->
<!--<scope>test</scope>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.junit.platform</groupId>-->
<!--<artifactId>junit-platform-runner</artifactId>-->
<!--<version>1.1.0</version>-->
<!--<scope>test</scope>-->
<!--</dependency>-->
<!-- for JUnit tests -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-messaging</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<!-- H2 database for junit tests only -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.197</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.directory.api</groupId>
<artifactId>apache-ldap-api</artifactId>
<version>1.0.0</version>
<type>pom</type>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast</artifactId>
</dependency>
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast-hibernate5</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.2.17.Final</version>
</dependency>
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast-spring</artifactId>
</dependency>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-901-1.jdbc4</version>
</dependency>
</dependencies>
<!-- end::security[] -->
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jdepend-maven-plugin</artifactId>
<version>2.0</version>
</plugin>
</plugins>
</reporting>
<build>
<plugins>
<!-- set Java version -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<dependencies>
<dependency>
<!-- contains the engine that actually runs the Jupiter-tests -->
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.2.0</version>
</dependency>
</dependencies>
</plugin>
<!-- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.19.1</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<skipTests>${skip.tests}</skipTests>
<argLine>${argLine} -Duser.timezone=UTC -Xms256m -Xmx256m</argLine>
<includes>
<includes>**/*Test*</includes>
</includes>
</configuration>
</execution>
</executions>
</plugin> -->
<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>1.1</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>de.agdsn.jcroft.Main</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.6.201602180812</version>
<executions>
<execution>
<id>agent-for-ut</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<append>true</append>
<destFile>${sonar.jacoco.reportPath}</destFile>
</configuration>
</execution>
<execution>
<id>agent-for-it</id>
<goals>
<goal>prepare-agent-integration</goal>
</goals>
<configuration>
<append>true</append>
<destFile>${sonar.jacoco.itReportPath}</destFile>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.7</version>
<configuration>
<formats>
<format>html</format>
<format>xml</format>
</formats>
<check/>
</configuration>
</plugin>
</plugins>
</build>
</project>
JUnit Test:
package de.agdsn.jcroft.database.data;
import de.agdsn.jcroft.database.model.Property;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import java.util.Optional;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@ExtendWith(SpringExtension.class)
@SpringBootTest
@ActiveProfiles("test")
class PropertyRepositoryTestJUnit5 {
@Autowired
protected PropertyRepository repository;
@Test
void saveProperty() {
//check for problems with spring, if spring cannot find bean
assertNotNull(repository);
Property property = new Property("test", "title");
repository.save(property);
//find property
Optional<Property> propertyOptional = repository.findById("test");
assertEquals(true, propertyOptional.isPresent());
Property property1 = propertyOptional.get();
assertEquals("test", property1.getToken());
assertEquals("title", property1.getTitle());
//create another property with same token
Property property2 = new Property("test", "title2");
repository.save(property2);
assertEquals(1, repository.findAll().size());
Optional<Property> propertyOptional1 = repository.findById("test");
assertEquals(true, propertyOptional1.isPresent());
Property property3 = propertyOptional1.get();
assertEquals("title2", property3.getTitle());
//check equals
assertEquals(false, property1.equals(property3));
assertEquals(true, property2.equals(property3));
}
}
On setter methods we have to check for special characters, which arent allowed (string validation for username, forename, lastname and so on).
Create models from database design.
Requires #17 .
If user authorities over ldap server and user is new to jcroft, we have to insert the user to the database.
Create a database design.
On ldap login we should get a list with all groups of user and update them in jcroft database.
Requires #33 .
Add a blacklist for usernames like "admin" and so on.
Integrate adminLTE design.
LDAP timeout doesnt work.
Add page layout.
In class Application method hazelcastInstance() we should fetch the config values from settings/jcroft.cfg file.
Add ldap timeout, so an exception will be thrown if ldap server is down.
This avoids long loading times on website, if ldap is down.
Enable gzip compression for static resources.
Add CSRF token.
Add software architecture.
Requires #5 .
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.