Skip to content

Commit

Permalink
Merge pull request #160 from Thadoy/feature/remove_legacy_mongo
Browse files Browse the repository at this point in the history
Feature/remove legacy mongo
  • Loading branch information
YukiInu authored Jun 18, 2024
2 parents ab08006 + 6a652e1 commit b0355f6
Show file tree
Hide file tree
Showing 92 changed files with 3,882 additions and 670 deletions.
8 changes: 4 additions & 4 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
* Migrated from JUnit 4 to JUnit 5
* Drop support for Powermock
* Switch Mockito to Mockito Inline for usage in static mocks
* Removed mongodb-driver-legacy from mongodb
* Deprecated mongo functionality was removed
* Complete overhaul for entity handling
* The old functionality is still available with the mongodb-legacy library
* Fixing an recurring ActiveMQ problem where messages can't be sent because ActiveMQ is to slow opening destination.
We do a resend after configurable retry time. If problem does not occur, nothing hanges.
* IVO generator: replaced old Apache BeanUtils with Spring beans BeanUtils
Expand Down
5 changes: 1 addition & 4 deletions archetypes/dvalin-archetype-parent.iml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<module version="4">
<component name="AdditionalModuleElements">
<content url="file://$MODULE_DIR$" dumb="true">
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
</component>
<component name="SonarLintModuleSettings">
<option name="uniqueId" value="1550f39e-5211-42d0-9707-106a048f7047" />
</component>
</module>
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.MockedStatic;
import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;

Expand Down
5 changes: 1 addition & 4 deletions cloud/dvalin-cloud-parent.iml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<module version="4">
<component name="AdditionalModuleElements">
<content url="file://$MODULE_DIR$" dumb="true">
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
</component>
<component name="SonarLintModuleSettings">
<option name="uniqueId" value="c2d793f0-e542-44fd-b34d-ce8438d9fa47" />
</component>
</module>
5 changes: 1 addition & 4 deletions cluster/dvalin-cluster-parent.iml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<module version="4">
<component name="AdditionalModuleElements">
<content url="file://$MODULE_DIR$" dumb="true">
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
</component>
<component name="SonarLintModuleSettings">
<option name="uniqueId" value="a28444bb-5298-4d52-9e90-5be68fc2d236" />
</component>
</module>
9 changes: 1 addition & 8 deletions dvalin-parent.iml
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" version="4">
<module version="4">
<component name="AdditionalModuleElements">
<content url="file://$MODULE_DIR$" dumb="true">
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
</component>
<component name="RModuleSettingsStorage">
<LOAD_PATH number="0" />
<I18N_FOLDERS number="1" string0="$MODULE_DIR$/i18n" />
</component>
<component name="SonarLintModuleSettings">
<option name="uniqueId" value="7c2c9c50-04a2-465d-baeb-9fd85282da67" />
</component>
</module>
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import de.taimos.dvalin.interconnect.model.event.IEvent;
import de.taimos.dvalin.interconnect.model.service.IEventHandler;
import org.apache.activemq.command.ActiveMQQueue;
import org.apache.activemq.jms.pool.PooledConnectionFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down
5 changes: 1 addition & 4 deletions interconnect/dvalin-interconnect-parent.iml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<module version="4">
<component name="AdditionalModuleElements">
<content url="file://$MODULE_DIR$" dumb="true">
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
</component>
<component name="SonarLintModuleSettings">
<option name="uniqueId" value="8fddd795-bb5b-4d86-8a08-26419d6f01ba" />
</component>
</module>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.springframework.beans.BeanUtils;

import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
import java.util.Collections;

Expand Down Expand Up @@ -58,15 +57,15 @@ public String getParentClazzName() {
}

protected void createMinMaxMember(MemberDef member) {
MemberDef min = BeanUtils.instantiateClass(member.getClass());
BeanUtils.copyProperties(member, min);
min.setName(min.getName() + "Min");
min.setFilterable(FilterableType.single);
this.addChild(min);
MemberDef max = BeanUtils.instantiateClass(member.getClass());
BeanUtils.copyProperties(member, max);
max.setName(max.getName() + "Max");
max.setFilterable(FilterableType.single);
this.addChild(max);
}
MemberDef min = BeanUtils.instantiateClass(member.getClass());
BeanUtils.copyProperties(member, min);
min.setName(min.getName() + "Min");
min.setFilterable(FilterableType.single);
this.addChild(min);
MemberDef max = BeanUtils.instantiateClass(member.getClass());
BeanUtils.copyProperties(member, max);
max.setName(max.getName() + "Max");
max.setFilterable(FilterableType.single);
this.addChild(max);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import javax.ws.rs.core.MediaType;

import org.apache.cxf.jaxrs.provider.StringTextProvider;
import org.junit.Assert;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
* #L%
*/

import org.junit.Assert;

import com.google.common.base.Stopwatch;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -57,7 +55,7 @@ void stopwatch() {
w.start();
boolean validate = hns.validate(password);
w.stop();
System.out.println(w.toString());
System.out.println(w);
Assertions.assertTrue(validate);
}

Expand Down
59 changes: 59 additions & 0 deletions mongodb-legacy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
## mongodb-legacy (Deprecated)

The mongodb-legacy library adds support for the MongoDB document store. By adding the dependency you get the
full support to interact with MongoDB databases including an in-memory database for tests.

This library uses the mongodb-driver-legacy mongo driver for java.

### Connection properties

The following settings are possible:

* `mongodb.type` - {fake|real} connect to real MongoDB database or in-memory version using `Mongo Java Server`
* `mongodb.name` - the name of the database to use for data storage
* `mongobee.enabled` - {true|false} use mongobee for database migration
* `mongobee.basepackage` - the base package of the Mongobee changesets
* `mongodb.demodata` - {true|false} load demodata on startup from ND-JSON files

For connections to real MongoDB databases, these extra properties can be set:

* `mongodb.host` - the host of the MongoDB instance (default: localhost)
* `mongodb.port` - the port of the MongoDB instance (default: 27017)
* `mongodb.uri` - instead of host and port you can specify the complete connection string
* `mongodb.sockettimeout` - the socket timeout of the connection (default: 10 seconds)
* `mongodb.connecttimeout` - the connection timeout of the connection attempt (default: 10 seconds)

### Access to database

To get access to the database inject the `MongoDBDataAccess<T>` for your entity class into your bean.
You can then call several methods to query and write data.

### Abstract entity and DAO interface

The library provides a general purpose DAO interface (`ICrudDAO`) and an abstract implementation
(`AbstractMongoDAO`) with many helper methods to ease the development of the data layer. For this to
work your entities have to extend the `AEntity` superclass. The DAOs created have integrated support
for JodaTime classes. If you want to use polymorphic types in your entities make sure to implement
`@IMappedSupertype` on the super class. This advises the Jackson mapper to include type information
into the created JSON for deserialization.

### Changesets

For database migration purpose the mongobee library is included and is configured as denoted above
using system properties. See the mongobee documentation on how to implement changesets.
For Index creation take a look at the `ChangelogUtil` helper class.

### MongoDBInit

To prefill the database with startup data or test data for integration tests put file on your classpath
into the package `mongodb` and name them using the following pattern: `<CollectionName>.ndjson`
If you set the system property `mongodb.demodata`to `true` dvalin will populate the given collections
with the objects contained in this new-line delimited files. Just put one JSON object per line.

### DocumentLinks

Another feature of dvalin's MongoDB support are DocumentLinks. These allow for references between your
documents. To include a reference in one of your entities just add a field of the generic type
`DocumentLink` and let your referenced entity implement `AReferenceableEntity`.
Dvalin will then include a reference to the given document in your JSON which you can resolve
by injecting the `IDlinkDAO` wherever you want.
Loading

0 comments on commit b0355f6

Please sign in to comment.