You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ol...@apache.org on 2021/06/20 10:21:47 UTC

[sling-org-apache-sling-commons-crypto] branch master updated: test deactivation without registered service

This is an automated email from the ASF dual-hosted git repository.

olli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-crypto.git


The following commit(s) were added to refs/heads/master by this push:
     new 07541f3  test deactivation without registered service
07541f3 is described below

commit 07541f32ad4b0ec64f5c71ea9d3b8313f906725c
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Sun Jun 20 12:21:38 2021 +0200

    test deactivation without registered service
---
 .../internal/JasyptRandomIvGeneratorRegistrar.java |  4 +--
 .../JasyptRandomSaltGeneratorRegistrar.java        |  4 +--
 .../JasyptRandomIvGeneratorRegistrarTest.java      | 31 ++++++++++++++++++++++
 .../JasyptRandomSaltGeneratorRegistrarTest.java    | 31 ++++++++++++++++++++++
 4 files changed, 66 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/sling/commons/crypto/jasypt/internal/JasyptRandomIvGeneratorRegistrar.java b/src/main/java/org/apache/sling/commons/crypto/jasypt/internal/JasyptRandomIvGeneratorRegistrar.java
index 104d71e..cd46bfc 100644
--- a/src/main/java/org/apache/sling/commons/crypto/jasypt/internal/JasyptRandomIvGeneratorRegistrar.java
+++ b/src/main/java/org/apache/sling/commons/crypto/jasypt/internal/JasyptRandomIvGeneratorRegistrar.java
@@ -55,7 +55,7 @@ public class JasyptRandomIvGeneratorRegistrar {
     }
 
     @Activate
-    private void activate(final JasyptRandomIvGeneratorRegistrarConfiguration configuration, final BundleContext bundleContext) {
+    protected void activate(final JasyptRandomIvGeneratorRegistrarConfiguration configuration, final BundleContext bundleContext) {
         logger.debug("activating");
         final String algorithm = configuration.algorithm();
         final RandomIvGenerator ivGenerator = new RandomIvGenerator(algorithm);
@@ -67,7 +67,7 @@ public class JasyptRandomIvGeneratorRegistrar {
     }
 
     @Deactivate
-    private void deactivate() {
+    protected void deactivate() {
         logger.debug("deactivating");
         if (Objects.nonNull(serviceRegistration)) {
             serviceRegistration.unregister();
diff --git a/src/main/java/org/apache/sling/commons/crypto/jasypt/internal/JasyptRandomSaltGeneratorRegistrar.java b/src/main/java/org/apache/sling/commons/crypto/jasypt/internal/JasyptRandomSaltGeneratorRegistrar.java
index 79b5704..d876b97 100644
--- a/src/main/java/org/apache/sling/commons/crypto/jasypt/internal/JasyptRandomSaltGeneratorRegistrar.java
+++ b/src/main/java/org/apache/sling/commons/crypto/jasypt/internal/JasyptRandomSaltGeneratorRegistrar.java
@@ -55,7 +55,7 @@ public class JasyptRandomSaltGeneratorRegistrar {
     }
 
     @Activate
-    private void activate(final JasyptRandomSaltGeneratorRegistrarConfiguration configuration, final BundleContext bundleContext) {
+    protected void activate(final JasyptRandomSaltGeneratorRegistrarConfiguration configuration, final BundleContext bundleContext) {
         logger.debug("activating");
         final String algorithm = configuration.algorithm();
         final RandomSaltGenerator saltGenerator = new RandomSaltGenerator(algorithm);
@@ -67,7 +67,7 @@ public class JasyptRandomSaltGeneratorRegistrar {
     }
 
     @Deactivate
-    private void deactivate() {
+    protected void deactivate() {
         logger.debug("deactivating");
         if (Objects.nonNull(serviceRegistration)) {
             serviceRegistration.unregister();
diff --git a/src/test/java/org/apache/sling/commons/crypto/jasypt/internal/JasyptRandomIvGeneratorRegistrarTest.java b/src/test/java/org/apache/sling/commons/crypto/jasypt/internal/JasyptRandomIvGeneratorRegistrarTest.java
new file mode 100644
index 0000000..f6301e3
--- /dev/null
+++ b/src/test/java/org/apache/sling/commons/crypto/jasypt/internal/JasyptRandomIvGeneratorRegistrarTest.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.commons.crypto.jasypt.internal;
+
+import org.junit.Test;
+
+public class JasyptRandomIvGeneratorRegistrarTest {
+
+    @Test
+    public void testDeactivate() {
+        final JasyptRandomIvGeneratorRegistrar registrar = new JasyptRandomIvGeneratorRegistrar();
+        registrar.deactivate();
+    }
+
+}
diff --git a/src/test/java/org/apache/sling/commons/crypto/jasypt/internal/JasyptRandomSaltGeneratorRegistrarTest.java b/src/test/java/org/apache/sling/commons/crypto/jasypt/internal/JasyptRandomSaltGeneratorRegistrarTest.java
new file mode 100644
index 0000000..2600e05
--- /dev/null
+++ b/src/test/java/org/apache/sling/commons/crypto/jasypt/internal/JasyptRandomSaltGeneratorRegistrarTest.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.commons.crypto.jasypt.internal;
+
+import org.junit.Test;
+
+public class JasyptRandomSaltGeneratorRegistrarTest {
+
+    @Test
+    public void testDeactivate() {
+        final JasyptRandomSaltGeneratorRegistrar registrar = new JasyptRandomSaltGeneratorRegistrar();
+        registrar.deactivate();
+    }
+
+}