[Git][java-team/plexus-cipher][master] 6 commits: Exclude the GitHub files from the upstream tarball

Emmanuel Bourg (@ebourg) gitlab at salsa.debian.org
Wed May 4 00:32:28 BST 2022



Emmanuel Bourg pushed to branch master at Debian Java Maintainers / plexus-cipher


Commits:
85d7e81d by Emmanuel Bourg at 2022-05-04T01:23:58+02:00
Exclude the GitHub files from the upstream tarball

- - - - -
46940012 by Emmanuel Bourg at 2022-05-04T01:24:13+02:00
New upstream version 2.0
- - - - -
f40b0559 by Emmanuel Bourg at 2022-05-04T01:24:13+02:00
Update upstream source from tag 'upstream/2.0'

Update to upstream version '2.0'
with Debian dir 00ecff2d8231c2f2c8f2c5f45e0db3297d658ce0
- - - - -
263ac11f by Emmanuel Bourg at 2022-05-04T01:30:27+02:00
Removed the patches

- - - - -
9e868525 by Emmanuel Bourg at 2022-05-04T01:30:34+02:00
Standards-Version updated to 4.6.0.1

- - - - -
88207fda by Emmanuel Bourg at 2022-05-04T01:32:10+02:00
Upload to unstable

- - - - -


16 changed files:

- .gitignore
- − .travis.yml
- README.md
- debian/changelog
- debian/control
- debian/copyright
- − debian/patches/series
- pom.xml
- src/main/java/org/sonatype/plexus/components/cipher/Base64.java
- src/main/java/org/sonatype/plexus/components/cipher/DefaultPlexusCipher.java
- src/main/java/org/sonatype/plexus/components/cipher/PBECipher.java
- src/main/java/org/sonatype/plexus/components/cipher/PlexusCipher.java
- src/main/java/org/sonatype/plexus/components/cipher/PlexusCipherException.java
- − src/main/resources/META-INF/plexus/components.xml
- src/test/java/org/sonatype/plexus/components/cipher/DefaultPlexusCipherTest.java
- src/test/java/org/sonatype/plexus/components/cipher/PBECipherTest.java


Changes:

=====================================
.gitignore
=====================================
@@ -3,3 +3,5 @@ target/
 .classpath
 .settings/
 bin
+*.iml
+


=====================================
.travis.yml deleted
=====================================
@@ -1,23 +0,0 @@
-language: java
-jdk:
-  - openjdk8
-  - openjdk11
-  - openjdk13
-  - openjdk14
-
-# No need for preliminary install step.
-install: true
-#
-# Run all integration tests.
-script: 
-  - "mvn --show-version --errors --batch-mode clean verify"
-#
-cache:
-    directories:
-    - $HOME/.m2
-branches:
-    except:
-        - gh-pages
-notifications:
-    email:
-        - khmarbaise at apache.org


=====================================
README.md
=====================================
@@ -2,7 +2,7 @@ Plexus-Cipher
 ============
 
 [![Build Status](https://travis-ci.org/codehaus-plexus/plexus-cipher.svg?branch=master)](https://travis-ci.org/codehaus-plexus/plexus-cipher)
-[![Maven Central](https://img.shields.io/maven-central/v/org.codehaus.plexus/plexus-cipher.svg?label=Maven%20Central)](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.codehaus.plexus%22%20a%3A%plexus-cipher%22)
+[![Maven Central](https://img.shields.io/maven-central/v/org.codehaus.plexus/plexus-cipher.svg?label=Maven%20Central)](https://search.maven.org/artifact/org.codehaus.plexus/plexus-cipher)
 
 The current master is now at https://github.com/codehaus-plexus/plexus-cipher
 


=====================================
debian/changelog
=====================================
@@ -1,3 +1,12 @@
+plexus-cipher (2.0-1) unstable; urgency=medium
+
+  * Team upload.
+  * New upstream release
+    - Removed the patches
+  * Standards-Version updated to 4.6.0.1
+
+ -- Emmanuel Bourg <ebourg at apache.org>  Wed, 04 May 2022 01:31:06 +0200
+
 plexus-cipher (1.8-2) unstable; urgency=medium
 
   * Team upload.


=====================================
debian/control
=====================================
@@ -10,7 +10,7 @@ Build-Depends:
  libeclipse-sisu-maven-plugin-java,
  libplexus-container-default1.5-java,
  maven-debian-helper (>= 2.2)
-Standards-Version: 4.5.1
+Standards-Version: 4.6.0.1
 Vcs-Git: https://salsa.debian.org/java-team/plexus-cipher.git
 Vcs-Browser: https://salsa.debian.org/java-team/plexus-cipher
 Homepage: https://github.com/codehaus-plexus/plexus-cipher


=====================================
debian/copyright
=====================================
@@ -2,6 +2,7 @@ Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
 Upstream-Name: Plexus Cipher Component
 Upstream-Contact: Sonatype
 Source: http://www.sonatype.org
+Files-Excluded: .github/*
 
 Files: *
 Copyright: 2008, Sonatype Inc.


=====================================
debian/patches/series deleted
=====================================
@@ -1,2 +0,0 @@
-sisu-maven-plugin.patch
-eclipse-sisu.patch


=====================================
pom.xml
=====================================
@@ -5,19 +5,19 @@
   <parent>
     <groupId>org.codehaus.plexus</groupId>
     <artifactId>plexus</artifactId>
-    <version>5.1</version>
+    <version>8</version>
   </parent>
 
   <artifactId>plexus-cipher</artifactId>
-  <version>1.8</version>
+  <version>2.0</version>
 
   <name>Plexus Cipher: encryption/decryption Component</name>
 
   <scm>
-    <connection>scm:git:git at github.com:codehaus-plexus/plexus-cipher.git</connection>
-    <developerConnection>scm:git:git at github.com:codehaus-plexus/plexus-cipher.git</developerConnection>
+    <connection>scm:git:https://github.com/codehaus-plexus/plexus-cipher.git</connection>
+    <developerConnection>scm:git:https://github.com/codehaus-plexus/plexus-cipher.git</developerConnection>
     <url>http://github.com/codehaus-plexus/plexus-cipher</url>
-    <tag>plexus-cipher-1.8</tag>
+    <tag>plexus-cipher-2.0</tag>
   </scm>
   <issueManagement>
     <system>jira</system>
@@ -32,15 +32,37 @@
 
   <properties>
     <javaVersion>7</javaVersion>
+    <sisuVersion>0.3.4</sisuVersion>
+    <project.build.outputTimestamp>2021-09-08T19:26:12Z</project.build.outputTimestamp>
   </properties>
-  
+
+  <dependencies>
+    <dependency>
+      <groupId>javax.inject</groupId>
+      <artifactId>javax.inject</artifactId>
+      <version>1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.eclipse.sisu</groupId>
+      <artifactId>org.eclipse.sisu.inject</artifactId>
+      <version>${sisuVersion}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.13.2</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
   <build>
     <pluginManagement>
       <plugins>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-surefire-plugin</artifactId>
-          <version>2.22.1</version>
+          <version>2.22.2</version>
         </plugin>
         <plugin>
           <groupId>org.eclipse.m2e</groupId>
@@ -51,9 +73,9 @@
               <pluginExecutions>
                 <pluginExecution>
                   <pluginExecutionFilter>
-                    <groupId>org.sonatype.plugins</groupId>
+                    <groupId>org.eclipse.sisu</groupId>
                     <artifactId>sisu-maven-plugin</artifactId>
-                    <versionRange>[1.1,)</versionRange>
+                    <versionRange>[0.3.4,)</versionRange>
                     <goals>
                       <goal>test-index</goal>
                       <goal>main-index</goal>
@@ -82,9 +104,7 @@
               <goal>test</goal>
             </goals>
             <configuration>
-              <systemPropertyVariables>
-                <file.encoding>utf8</file.encoding>
-              </systemPropertyVariables>
+              <argLine>-Dfile.encoding=utf8</argLine>
             </configuration>
           </execution>
           <execution>
@@ -94,18 +114,16 @@
               <goal>test</goal>
             </goals>
             <configuration>
-              <systemPropertyVariables>
-                <file.encoding>iso8859-1</file.encoding>
-              </systemPropertyVariables>
+              <argLine>-Dfile.encoding=iso8859-1</argLine>
             </configuration>
           </execution>
         </executions>
       </plugin>
 
       <plugin>
-        <groupId>org.sonatype.plugins</groupId>
+        <groupId>org.eclipse.sisu</groupId>
         <artifactId>sisu-maven-plugin</artifactId>
-        <version>1.1</version>
+        <version>${sisuVersion}</version>
         <executions>
           <execution>
             <goals>
@@ -118,19 +136,4 @@
     </plugins>
   </build>
 
-  <dependencies>
-    <dependency>
-      <groupId>org.sonatype.sisu</groupId>
-      <artifactId>sisu-inject-bean</artifactId>
-      <version>2.6.0</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.12</version>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-
 </project>


=====================================
src/main/java/org/sonatype/plexus/components/cipher/Base64.java
=====================================
@@ -95,7 +95,7 @@ public class Base64
      * The value of undefined encodings is <code>-1</code>.
      * </p>
      */
-    private static byte[] base64Alphabet = new byte[BASELENGTH];
+    private static final byte[] base64Alphabet = new byte[BASELENGTH];
 
     /**
      * <p/>
@@ -110,7 +110,7 @@ public class Base64
      * For example, <code>lookUpBase64Alphabet[62] </code> returns <code>'+'</code>.
      * </p>
      */
-    private static byte[] lookUpBase64Alphabet = new byte[LOOKUPLENGTH];
+    private static final byte[] lookUpBase64Alphabet = new byte[LOOKUPLENGTH];
 
     // Populating the lookup and character arrays
     static {


=====================================
src/main/java/org/sonatype/plexus/components/cipher/DefaultPlexusCipher.java
=====================================
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2008 Sonatype, Inc. All rights reserved.
  *
  * This program is licensed to you under the Apache License Version 2.0,
@@ -15,35 +15,38 @@ package org.sonatype.plexus.components.cipher;
 import java.security.Provider;
 import java.security.Security;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Set;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import javax.enterprise.inject.Typed;
 import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.eclipse.sisu.Typed;
 
 /**
+ * Default implementation of {@link PlexusCipher}. This class is thread safe.
+ *
  * @author Oleg Gusakov
  */
+ at Singleton
 @Named( "default" )
 @Typed( PlexusCipher.class )
 public class DefaultPlexusCipher
     implements PlexusCipher
 {
-
     private static final Pattern ENCRYPTED_STRING_PATTERN = Pattern.compile( ".*?[^\\\\]?\\{(.*?[^\\\\])\\}.*" );
 
     private final PBECipher _cipher;
 
     // ---------------------------------------------------------------
     public DefaultPlexusCipher()
-        throws PlexusCipherException
     {
         _cipher = new PBECipher();
     }
 
     // ---------------------------------------------------------------
+    @Override
     public String encrypt( final String str, final String passPhrase )
         throws PlexusCipherException
     {
@@ -56,6 +59,7 @@ public class DefaultPlexusCipher
     }
 
     // ---------------------------------------------------------------
+    @Override
     public String encryptAndDecorate( final String str, final String passPhrase )
         throws PlexusCipherException
     {
@@ -63,6 +67,7 @@ public class DefaultPlexusCipher
     }
 
     // ---------------------------------------------------------------
+    @Override
     public String decrypt( final String str, final String passPhrase )
         throws PlexusCipherException
     {
@@ -75,6 +80,7 @@ public class DefaultPlexusCipher
     }
 
     // ---------------------------------------------------------------
+    @Override
     public String decryptDecorated( final String str, final String passPhrase )
         throws PlexusCipherException
     {
@@ -92,6 +98,7 @@ public class DefaultPlexusCipher
     }
 
     // ----------------------------------------------------------------------------
+    @Override
     public boolean isEncryptedString( final String str )
     {
         if ( str == null || str.length() < 1 )
@@ -105,7 +112,7 @@ public class DefaultPlexusCipher
     }
 
     // ----------------------------------------------------------------------------
-    // -------------------
+    @Override
     public String unDecorate( final String str )
         throws PlexusCipherException
     {
@@ -122,43 +129,39 @@ public class DefaultPlexusCipher
     }
 
     // ----------------------------------------------------------------------------
-    // -------------------
+    @Override
     public String decorate( final String str )
     {
         return ENCRYPTED_STRING_DECORATION_START + ( str == null ? "" : str ) + ENCRYPTED_STRING_DECORATION_STOP;
     }
 
     // ---------------------------------------------------------------
-    // ---------------------------------------------------------------
-    // ***************************************************************
+
     /**
      * Exploratory part. This method returns all available services types
      */
     public static String[] getServiceTypes()
     {
-        Set result = new HashSet();
+        Set<String> result = new HashSet<>();
 
         // All all providers
         Provider[] providers = Security.getProviders();
-        for ( int i = 0; i < providers.length; i++ )
-        {
+        for (Provider provider : providers) {
             // Get services provided by each provider
-            Set keys = providers[i].keySet();
-            for ( Iterator it = keys.iterator(); it.hasNext(); )
-            {
-                String key = (String) it.next();
-                key = key.split( " " )[0];
-
-                if ( key.startsWith( "Alg.Alias." ) )
-                {
+            Set<Object> keys = provider.keySet();
+            for (Object o : keys) {
+                String key = (String) o;
+                key = key.split(" ")[0];
+
+                if (key.startsWith("Alg.Alias.")) {
                     // Strip the alias
-                    key = key.substring( 10 );
+                    key = key.substring(10);
                 }
-                int ix = key.indexOf( '.' );
-                result.add( key.substring( 0, ix ) );
+                int ix = key.indexOf('.');
+                result.add(key.substring(0, ix));
             }
         }
-        return (String[]) result.toArray( new String[result.size()] );
+        return result.toArray( new String[result.size()] );
     }
 
     /**
@@ -166,31 +169,27 @@ public class DefaultPlexusCipher
      */
     public static String[] getCryptoImpls( final String serviceType )
     {
-        Set result = new HashSet();
+        Set<String> result = new HashSet<>();
 
         // All all providers
         Provider[] providers = Security.getProviders();
-        for ( int i = 0; i < providers.length; i++ )
-        {
+        for (Provider provider : providers) {
             // Get services provided by each provider
-            Set keys = providers[i].keySet();
-            for ( Iterator it = keys.iterator(); it.hasNext(); )
-            {
-                String key = (String) it.next();
-                key = key.split( " " )[0];
-
-                if ( key.startsWith( serviceType + "." ) )
-                {
-                    result.add( key.substring( serviceType.length() + 1 ) );
+            Set<Object> keys = provider.keySet();
+            for (Object o : keys) {
+                String key = (String) o;
+                key = key.split(" ")[0];
+
+                if (key.startsWith(serviceType + ".")) {
+                    result.add(key.substring(serviceType.length() + 1));
                 }
-                else if ( key.startsWith( "Alg.Alias." + serviceType + "." ) )
-                {
+                else if (key.startsWith("Alg.Alias." + serviceType + ".")) {
                     // This is an alias
-                    result.add( key.substring( serviceType.length() + 11 ) );
+                    result.add(key.substring(serviceType.length() + 11));
                 }
             }
         }
-        return (String[]) result.toArray( new String[result.size()] );
+        return result.toArray( new String[result.size()] );
     }
 
     // ---------------------------------------------------------------
@@ -201,26 +200,18 @@ public class DefaultPlexusCipher
         String[] serviceTypes = getServiceTypes();
         if ( serviceTypes != null )
         {
-            for ( int i = 0; i < serviceTypes.length; i++ )
-            {
-                String serviceType = serviceTypes[i];
-                String[] serviceProviders = getCryptoImpls( serviceType );
-                if ( serviceProviders != null )
-                {
-                    System.out.println( serviceType + ": provider list" );
-                    for ( int j = 0; j < serviceProviders.length; j++ )
-                    {
-                        String provider = serviceProviders[j];
-                        System.out.println( "        " + provider );
+            for (String serviceType : serviceTypes) {
+                String[] serviceProviders = getCryptoImpls(serviceType);
+                if (serviceProviders != null) {
+                    System.out.println(serviceType + ": provider list");
+                    for (String provider : serviceProviders) {
+                        System.out.println("        " + provider);
                     }
                 }
-                else
-                {
-                    System.out.println( serviceType + ": does not have any providers in this environment" );
+                else {
+                    System.out.println(serviceType + ": does not have any providers in this environment");
                 }
             }
         }
     }
-    // ---------------------------------------------------------------
-    // ---------------------------------------------------------------
 }


=====================================
src/main/java/org/sonatype/plexus/components/cipher/PBECipher.java
=====================================
@@ -1,4 +1,4 @@
-/**
+/*
  * createCipher routine was adopted from http://juliusdavies.ca/svn/not-yet-commons-ssl/tags/commons-ssl-0.3.10/src/java/org/apache/commons/ssl/OpenSSL.java
  * which is distributed under APL-2.0 license: http://www.apache.org/licenses/LICENSE-2.0
  */
@@ -28,9 +28,7 @@ import java.security.InvalidAlgorithmParameterException;
 import java.security.InvalidKeyException;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
 import java.security.SecureRandom;
-import java.util.Random;
 
 import javax.crypto.Cipher;
 import javax.crypto.NoSuchPaddingException;
@@ -38,6 +36,8 @@ import javax.crypto.spec.IvParameterSpec;
 import javax.crypto.spec.SecretKeySpec;
 
 /**
+ * This class is thread-safe.
+ *
  * @author Oleg Gusakov
  */
 public class PBECipher
@@ -58,25 +58,10 @@ public class PBECipher
 
     protected static final String CIPHER_ALG = "AES/CBC/PKCS5Padding";
 
-    protected static int PBE_ITERATIONS = 1000;
+    protected static final int PBE_ITERATIONS = 1000;
 
-    protected MessageDigest _digester;
-    
     private static final SecureRandom _secureRandom = new SecureRandom();
 
-    //---------------------------------------------------------------
-    public PBECipher()
-    throws PlexusCipherException
-    {
-        try
-        {
-            _digester = MessageDigest.getInstance( DIGEST_ALG );
-        }
-        catch ( NoSuchAlgorithmException e )
-        {
-            throw new PlexusCipherException(e);
-        }
-    }
     //---------------------------------------------------------------
     private byte[] getSalt( final int sz )
     {
@@ -116,9 +101,7 @@ public class PBECipher
             
             byte [] encryptedTextBytes = Base64.encodeBase64( allEncryptedBytes );
             
-            String encryptedText = new String( encryptedTextBytes, STRING_ENCODING );
-    
-            return encryptedText;
+            return new String( encryptedTextBytes, STRING_ENCODING );
         }
         catch( Exception e)
         {
@@ -150,9 +133,7 @@ public class PBECipher
     
             byte [] clearBytes = cipher.doFinal( encryptedBytes );
             
-            String clearText = new String( clearBytes, STRING_ENCODING ); 
-    
-            return clearText;
+            return new String( clearBytes, STRING_ENCODING );
         }
         catch( Exception e)
         {
@@ -163,8 +144,8 @@ public class PBECipher
     private Cipher createCipher( final byte [] pwdAsBytes, byte [] salt, final int mode )
     throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException
     {
-        _digester.reset();
-        
+        MessageDigest _digester = MessageDigest.getInstance( DIGEST_ALG );
+
         byte[] keyAndIv = new byte[ SPICE_SIZE * 2 ];
         
         if( salt == null || salt.length == 0 )
@@ -234,6 +215,4 @@ public class PBECipher
         
         return cipher;
     }
-    //-------------------------------------------------------------------------------
-    //-------------------------------------------------------------------------------
 }


=====================================
src/main/java/org/sonatype/plexus/components/cipher/PlexusCipher.java
=====================================
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2008 Sonatype, Inc. All rights reserved.
  *
  * This program is licensed to you under the Apache License Version 2.0,
@@ -17,16 +17,16 @@ package org.sonatype.plexus.components.cipher;
  */
 public interface PlexusCipher
 {
-    public static final char ENCRYPTED_STRING_DECORATION_START = '{';
+    char ENCRYPTED_STRING_DECORATION_START = '{';
 
-    public static final char ENCRYPTED_STRING_DECORATION_STOP = '}';
+    char ENCRYPTED_STRING_DECORATION_STOP = '}';
 
     /**
      * encrypt given string with the given passPhrase and encode it into base64
      * 
      * @param str
      * @param passPhrase
-     * @return
+     * @return encrypted str
      * @throws PlexusCipherException
      */
     String encrypt( String str, String passPhrase )
@@ -38,7 +38,7 @@ public interface PlexusCipher
      * 
      * @param str
      * @param passPhrase
-     * @return
+     * @return encrypted and decorated str
      * @throws PlexusCipherException
      */
     String encryptAndDecorate( String str, String passPhrase )
@@ -49,7 +49,7 @@ public interface PlexusCipher
      * 
      * @param str
      * @param passPhrase
-     * @return
+     * @return decrypted str
      * @throws PlexusCipherException
      */
     String decrypt( String str, String passPhrase )
@@ -61,7 +61,7 @@ public interface PlexusCipher
      * 
      * @param str
      * @param passPhrase
-     * @return
+     * @return decrypted decorated str
      * @throws PlexusCipherException
      */
     String decryptDecorated( String str, String passPhrase )
@@ -71,26 +71,25 @@ public interface PlexusCipher
      * check if given string is decorated
      * 
      * @param str
-     * @return
+     * @return true if string is encrypted
      */
-    public boolean isEncryptedString( String str );
+    boolean isEncryptedString( String str );
 
     /**
      * return string inside decorations
      * 
      * @param str
-     * @return
+     * @return undecorated str
      * @throws PlexusCipherException
      */
-    public String unDecorate( String str )
+    String unDecorate( String str )
         throws PlexusCipherException;
 
     /**
      * decorated given string with { and }
      * 
      * @param str
-     * @return
+     * @return decorated str
      */
-    public String decorate( String str );
-
+    String decorate( String str );
 }


=====================================
src/main/java/org/sonatype/plexus/components/cipher/PlexusCipherException.java
=====================================
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2008 Sonatype, Inc. All rights reserved.
  *
  * This program is licensed to you under the Apache License Version 2.0,
@@ -15,7 +15,6 @@ package org.sonatype.plexus.components.cipher;
 public class PlexusCipherException
     extends Exception
 {
-
     public PlexusCipherException()
     {
     }
@@ -34,5 +33,4 @@ public class PlexusCipherException
     {
         super( message, cause );
     }
-
 }


=====================================
src/main/resources/META-INF/plexus/components.xml deleted
=====================================
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<component-set>
-  <components>
-    <component>
-      <role>org.sonatype.plexus.components.cipher.PlexusCipher</role>
-      <role-hint>default</role-hint>
-      <implementation>org.sonatype.plexus.components.cipher.DefaultPlexusCipher</implementation>
-      <description />
-      <isolated-realm>false</isolated-realm>
-    </component>
-  </components>
-</component-set>


=====================================
src/test/java/org/sonatype/plexus/components/cipher/DefaultPlexusCipherTest.java
=====================================
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2008 Sonatype, Inc. All rights reserved.
  *
  * This program is licensed to you under the Apache License Version 2.0,
@@ -12,7 +12,13 @@
  */
 package org.sonatype.plexus.components.cipher;
 
-import org.sonatype.guice.bean.containers.InjectedTestCase;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
 /**
  * Test the Plexus Cipher container
@@ -20,9 +26,8 @@ import org.sonatype.guice.bean.containers.InjectedTestCase;
  * @author Oleg Gusakov
  */
 public class DefaultPlexusCipherTest
-    extends InjectedTestCase
 {
-    private String passPhrase = "testtest";
+    private final String passPhrase = "testtest";
 
     String str = "my testing phrase";
 
@@ -31,14 +36,14 @@ public class DefaultPlexusCipherTest
     DefaultPlexusCipher pc;
 
     // -------------------------------------------------------------
-    public void setUp()
+    @Before
+    public void prepare()
         throws Exception
     {
-        super.setUp();
-
         pc = new DefaultPlexusCipher();
     }
 
+    @Test
     public void testIsEncryptedString()
     {
         String noBraces = "This is a test";
@@ -55,6 +60,7 @@ public class DefaultPlexusCipherTest
         assertTrue( pc.isEncryptedString( mixedBraces ) );
     }
 
+    @Test
     public void testUnDecorate_BracesPermutations()
         throws PlexusCipherException
     {
@@ -68,6 +74,8 @@ public class DefaultPlexusCipherTest
     }
 
     // -------------------------------------------------------------
+
+    @Test
     public void testDefaultAlgorithmExists()
         throws Exception
     {
@@ -92,6 +100,8 @@ public class DefaultPlexusCipherTest
     }
 
     // -------------------------------------------------------------
+
+    @Test
     public void stestFindDefaultAlgorithm()
         throws Exception
     {
@@ -117,6 +127,8 @@ public class DefaultPlexusCipherTest
     }
 
     // -------------------------------------------------------------
+
+    @Test
     public void testEncrypt()
         throws Exception
     {
@@ -130,6 +142,8 @@ public class DefaultPlexusCipherTest
     }
 
     // -------------------------------------------------------------
+
+    @Test
     public void testEncryptVariableLengths()
         throws Exception
     {
@@ -160,6 +174,8 @@ public class DefaultPlexusCipherTest
     }
 
     // -------------------------------------------------------------
+
+    @Test
     public void testDecorate()
         throws Exception
     {
@@ -169,6 +185,8 @@ public class DefaultPlexusCipherTest
     }
 
     // -------------------------------------------------------------
+
+    @Test
     public void testUnDecorate()
         throws Exception
     {
@@ -179,6 +197,8 @@ public class DefaultPlexusCipherTest
     }
 
     // -------------------------------------------------------------
+
+    @Test
     public void testEncryptAndDecorate()
         throws Exception
     {
@@ -186,6 +206,4 @@ public class DefaultPlexusCipherTest
 
         assertEquals( '{', res.charAt( 0 ) );
     }
-    // -------------------------------------------------------------
-    // -------------------------------------------------------------
 }


=====================================
src/test/java/org/sonatype/plexus/components/cipher/PBECipherTest.java
=====================================
@@ -19,13 +19,17 @@ under the License.
 
 package org.sonatype.plexus.components.cipher;
 
-import org.sonatype.guice.bean.containers.InjectedTestCase;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
 
 /**
  * @author Oleg Gusakov
  */
 public class PBECipherTest
-    extends InjectedTestCase
 {
     PBECipher _cipher;
 
@@ -35,13 +39,14 @@ public class PBECipherTest
 
     String _password = "testtest";
 
-    protected void setUp()
+    @Before
+    public void prepare()
         throws Exception
     {
-        super.setUp();
         _cipher = new PBECipher();
     }
 
+    @Test
     public void testEncrypt()
         throws Exception
     {
@@ -60,6 +65,7 @@ public class PBECipherTest
         assertFalse( enc.equals( enc2 ) );
     }
 
+    @Test
     public void testDecrypt()
         throws Exception
     {
@@ -67,7 +73,8 @@ public class PBECipherTest
 
         assertEquals( _cleatText, clear );
     }
-    
+
+    @Test
     public void testEncoding()
     	throws Exception
     {



View it on GitLab: https://salsa.debian.org/java-team/plexus-cipher/-/compare/3cb4408dcb65d67a7a6ce30bfb5c8165c065da64...88207fda50f1bdc9acc972190a27517672b95a70

-- 
View it on GitLab: https://salsa.debian.org/java-team/plexus-cipher/-/compare/3cb4408dcb65d67a7a6ce30bfb5c8165c065da64...88207fda50f1bdc9acc972190a27517672b95a70
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20220503/998c8c52/attachment.htm>


More information about the pkg-java-commits mailing list