diff --git a/sample-operators/leader-election/pom.xml b/sample-operators/leader-election/pom.xml index 3a1b0a48a3..bcbc4fbcff 100644 --- a/sample-operators/leader-election/pom.xml +++ b/sample-operators/leader-election/pom.xml @@ -33,6 +33,12 @@ org.apache.logging.log4j log4j-slf4j-impl + compile + + + org.apache.logging.log4j + log4j-core + compile org.takes diff --git a/sample-operators/mysql-schema/pom.xml b/sample-operators/mysql-schema/pom.xml index 554a937f2c..dedb681116 100644 --- a/sample-operators/mysql-schema/pom.xml +++ b/sample-operators/mysql-schema/pom.xml @@ -53,6 +53,11 @@ org.apache.logging.log4j log4j-slf4j-impl + + org.apache.logging.log4j + log4j-core + compile + org.junit.jupiter junit-jupiter-api diff --git a/sample-operators/mysql-schema/src/main/java/io/javaoperatorsdk/operator/sample/dependent/SchemaDependentResource.java b/sample-operators/mysql-schema/src/main/java/io/javaoperatorsdk/operator/sample/dependent/SchemaDependentResource.java index 77d8932e58..476898af00 100644 --- a/sample-operators/mysql-schema/src/main/java/io/javaoperatorsdk/operator/sample/dependent/SchemaDependentResource.java +++ b/sample-operators/mysql-schema/src/main/java/io/javaoperatorsdk/operator/sample/dependent/SchemaDependentResource.java @@ -30,7 +30,7 @@ import static io.javaoperatorsdk.operator.sample.dependent.SecretDependentResource.MYSQL_SECRET_USERNAME; import static java.lang.String.format; -@SchemaConfig(pollPeriod = 700, host = "127.0.0.1", +@SchemaConfig(pollPeriod = 400, host = "127.0.0.1", port = SchemaDependentResource.LOCAL_PORT, user = "root", password = "password") // NOSONAR: password is only used locally, example only @Configured(by = SchemaConfig.class, with = ResourcePollerConfig.class, @@ -63,7 +63,9 @@ public void configureWith(ResourcePollerConfig config) { @Override public Schema desired(MySQLSchema primary, Context context) { - return new Schema(primary.getMetadata().getName(), primary.getSpec().getEncoding()); + var desired = new Schema(primary.getMetadata().getName(), primary.getSpec().getEncoding()); + log.debug("Desired schema: {}", desired); + return desired; } @Override @@ -72,6 +74,7 @@ public Schema create(Schema target, MySQLSchema mySQLSchema, Context fetchResources(MySQLSchema primaryResource) { try (Connection connection = getConnection()) { - return SchemaService.getSchema(connection, primaryResource.getMetadata().getName()) + var schema = SchemaService.getSchema(connection, primaryResource.getMetadata().getName()) .map(Set::of).orElseGet(Collections::emptySet); + log.debug("Fetched schema: {}", schema); + return schema; } catch (SQLException e) { throw new RuntimeException("Error while trying read Schema", e); } diff --git a/sample-operators/mysql-schema/src/main/java/io/javaoperatorsdk/operator/sample/schema/Schema.java b/sample-operators/mysql-schema/src/main/java/io/javaoperatorsdk/operator/sample/schema/Schema.java index 34c1e54255..87fb88e9a4 100644 --- a/sample-operators/mysql-schema/src/main/java/io/javaoperatorsdk/operator/sample/schema/Schema.java +++ b/sample-operators/mysql-schema/src/main/java/io/javaoperatorsdk/operator/sample/schema/Schema.java @@ -28,11 +28,19 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) return false; Schema schema = (Schema) o; - return Objects.equals(name, schema.name) && Objects.equals(characterSet, schema.characterSet); + return Objects.equals(name, schema.name); } @Override public int hashCode() { return Objects.hash(name, characterSet); } + + @Override + public String toString() { + return "Schema{" + + "name='" + name + '\'' + + ", characterSet='" + characterSet + '\'' + + '}'; + } } diff --git a/sample-operators/tomcat-operator/pom.xml b/sample-operators/tomcat-operator/pom.xml index 5e04d9c88c..158133160d 100644 --- a/sample-operators/tomcat-operator/pom.xml +++ b/sample-operators/tomcat-operator/pom.xml @@ -49,6 +49,11 @@ org.apache.logging.log4j log4j-slf4j-impl + + org.apache.logging.log4j + log4j-core + compile + org.takes takes diff --git a/sample-operators/webpage/pom.xml b/sample-operators/webpage/pom.xml index ad961b8393..5470ece6d3 100644 --- a/sample-operators/webpage/pom.xml +++ b/sample-operators/webpage/pom.xml @@ -34,6 +34,11 @@ org.apache.logging.log4j log4j-slf4j-impl + + org.apache.logging.log4j + log4j-core + compile + org.takes takes