Skip to content

Commit 2603f04

Browse files
authored
Merge pull request #163 from OsgiliathEnterprise/bumpspring
Sonarqube smells
2 parents f9382b5 + 7704400 commit 2603f04

File tree

8 files changed

+14
-21
lines changed

8 files changed

+14
-21
lines changed

core/src/main/java/net/osgiliath/migrator/core/configuration/beans/GraphTraversalSourceProvider.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@
2525
import org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteConnection;
2626
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
2727
import org.apache.tinkerpop.gremlin.structure.Graph;
28-
import org.apache.tinkerpop.gremlin.structure.io.IoRegistry;
2928
import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
30-
import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV3;
3129
import org.springframework.stereotype.Component;
3230

3331
import static org.apache.tinkerpop.gremlin.process.traversal.AnonymousTraversalSource.traversal;
@@ -62,20 +60,18 @@ public GraphTraversalSource getGraph() {
6260
Graph graph = TinkerGraph.open();
6361
return traversal().withEmbedded(graph);
6462
} else if (dataMigratorConfiguration.getGraphDatasource().getType().equals(GraphDatasourceType.REMOTE)) {
65-
IoRegistry registry = TinkerIoRegistryV3.instance();
66-
/* TypeSerializerRegistry typeSerializerRegistry = TypeSerializerRegistry.build().addRegistry(registry)
67-
.create();*/
68-
69-
/* GraphSONMapper.Builder builder = GraphSONMapper.build().
63+
/* IoRegistry registry = TinkerIoRegistryV3.instance();
64+
TypeSerializerRegistry typeSerializerRegistry = TypeSerializerRegistry.build().addRegistry(registry)
65+
.create();
66+
GraphSONMapper.Builder builder = GraphSONMapper.build().
7067
typeInfo(TypeInfo.PARTIAL_TYPES)
7168
// .addCustomModule(new JpaMetamodelSerializationModule())
7269
.addCustomModule(GraphSONXModuleV3.build())
7370
.version(GraphSONVersion.V3_0);
74-
MessageSerializer serializer = new GraphSONMessageSerializerV3(builder); //typeSerializerRegistry);*/
75-
/* Cluster cluster = Cluster.build(dataMigratorConfiguration.getGraphDatasource().getHost()).port(dataMigratorConfiguration.getGraphDatasource().getPort()).
71+
MessageSerializer serializer = new GraphSONMessageSerializerV3(builder); //typeSerializerRegistry);
72+
Cluster cluster = Cluster.build(dataMigratorConfiguration.getGraphDatasource().getHost()).port(dataMigratorConfiguration.getGraphDatasource().getPort()).
7673
serializer(new GraphBinaryMessageSerializerV1(typeSerializerRegistry)).
7774
create();
78-
7975
Client client = cluster.connect();*/
8076
return traversal().withRemote(DriverRemoteConnection.using(dataMigratorConfiguration.getGraphDatasource().getHost(), dataMigratorConfiguration.getGraphDatasource().getPort()));
8177
} else {

core/src/main/java/net/osgiliath/migrator/core/rawelement/jpa/JpaRelationshipProcessor.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ public Object getEdgeRawValue(ModelElement modelElement, Method getterMethod) {
7878

7979
@Override
8080
public void setEdgeRawValue(String fieldName, Field metamodelField, MetamodelVertex target, ModelElement modelElement, Object value) {
81-
jpaEntityProcessor.getId(modelElement).ifPresent(id -> {
82-
log.debug("setting raw value for edge {} to modelElement {}", fieldName, id);
83-
});
81+
jpaEntityProcessor.getId(modelElement).ifPresent(id ->
82+
log.debug("setting raw value for edge {} to modelElement {}", fieldName, id)
83+
);
8484
jpaEntityProcessor.setFieldValue(modelElement, fieldName, value);
8585
jpaEntityProcessor.getterMethod(modelElement.vertex(), metamodelField).flatMap(
8686
method -> inverseRelationshipField(method, target)
@@ -394,7 +394,6 @@ public boolean isDerived(Class<?> entityClass, String attributeName) {
394394
*/
395395
public boolean isFkIgnored(Class<?> entityClass, String attributeName) {
396396
try {
397-
398397
return Arrays.stream(Introspector.getBeanInfo(entityClass).getPropertyDescriptors())
399398
.filter(pd -> attributeName.equals(pd.getName()))
400399
.map(PropertyDescriptor::getReadMethod)

core/src/test/java/net/osgiliath/migrator/core/graph/ModelElementTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ void testGetEdgeValueFromVertexGraphToOne() throws NoSuchMethodException {
9595
Optional<EdgeTargetVertexOrVertices> result = modelGraphEdgeBuilder.getEdgeValueFromVertexGraph(modelElement, fieldEdge, graphTraversalSource);
9696
// Assert
9797
assertTrue(result.isPresent());
98-
Assertions.assertEquals(((UnitaryEdgeTarget) result.get()).target().id(), MockTraversalVertex.ENTITY_ID_1);
98+
Assertions.assertEquals(MockTraversalVertex.ENTITY_ID_1, ((UnitaryEdgeTarget) result.get()).target().id());
9999
}
100100

101101
@Transactional

core/src/test/java/net/osgiliath/migrator/core/graph/ModelGraphBuilderTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ void testModelGraphFromMetamodelGraph() {
101101
void testCreateEdges() {
102102
// Arrange
103103
MetamodelVertex metamodelVertex = new JpaMetamodelVertex(MetamodelClass.class, FakeEntity.class);
104-
FieldEdge<MetamodelVertex> fieldEdge = new FieldEdge(null);
105104
Set<MetamodelVertex> metaVertex = new HashSet<>();
106105
metaVertex.add(metamodelVertex);
107106
GraphTraversal g = new DefaultGraphTraversal();

core/src/test/java/net/osgiliath/migrator/core/rawelement/jpa/JpaEntityProcessorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void testGetEntityId() {
5454
TestEntity ent = new TestEntity();
5555
JpaMetamodelVertex jpaMetamodelVertex = new JpaMetamodelVertex(null, TestEntity.class);
5656
Optional<Object> ret = jpaEntityProcessor.getId(jpaMetamodelVertex, ent);
57-
assertThat(ret.get()).isEqualTo(1L);
57+
assertThat(ret).contains(1L);
5858
}
5959

6060
@Test

report-aggregate/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>net.osgiliath.datamigrator</groupId>
88
<artifactId>data-migrator</artifactId>
9-
<version>1.108-SNAPSHOT</version>
9+
<version>1.109-SNAPSHOT</version>
1010
</parent>
1111
<artifactId>report-aggregate</artifactId>
1212
<name>datamigrator-report-aggregate</name>

sample-mono/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>net.osgiliath.datamigrator</groupId>
88
<artifactId>data-migrator</artifactId>
9-
<version>1.108-SNAPSHOT</version>
9+
<version>1.109-SNAPSHOT</version>
1010
<relativePath>../pom.xml</relativePath>
1111
</parent>
1212
<groupId>net.osgiliath.datamigrator.sample</groupId>

sample-mono/src/test/java/net/osgiliath/InjectionIT.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ class InjectionIT {
5050
@Container
5151
static MySQLContainer mySQLSourceContainer = (MySQLContainer) new MySQLContainer(DockerImageName.parse("mysql:" + mysqlVersion))
5252
.withConnectTimeoutSeconds(mysqlTimeoutInSecond.intValue());
53-
;
5453
// .withExposedPorts(64449);
5554

5655
@Container
@@ -117,7 +116,7 @@ void givenFedGraphWhenEntityProcessorIsCalledThenTargetDatabaseIsPopulatedExclud
117116
try (GraphTraversalSource modelGraph = modelGraphBuilder.modelGraphFromMetamodelGraph(entityMetamodelGraph)) {
118117
sinkEntityInjector.persist(modelGraph, entityMetamodelGraph);
119118
List<Employee> employees = employeeRepository.findAll();
120-
assertThat(employees.size()).isLessThan(13); // Two employees has a cycle
119+
assertThat(employees).hasSizeLessThan(13); // Two employees has a cycle
121120
List<Job> jobs = jobRepository.findAll();
122121
assertThat(jobs).hasSize(10); // has not been limited because intermediairy employee should have been removed
123122

0 commit comments

Comments
 (0)