Examples of calcDigestString()


Examples of org.rhq.core.util.MessageDigestGenerator.calcDigestString()

        PowerMockito.mockStatic(ContentFileInfoFactory.class);
        when(ContentFileInfoFactory.createContentFileInfo(any(File.class))).thenReturn(contentFileInfo);

        MessageDigestGenerator mockDigest = mock(MessageDigestGenerator.class);
        whenNew(MessageDigestGenerator.class).withArguments(anyString()).thenReturn(mockDigest);
        when(mockDigest.calcDigestString(any(File.class))).thenReturn("sha256");

        when(mockFile.getName()).thenReturn("fileName");
        when(mockFile.getAbsolutePath()).thenReturn("mock path");

        //create object to test and inject required dependencies
View Full Code Here

Examples of org.rhq.core.util.MessageDigestGenerator.calcDigestString()

        PowerMockito.mockStatic(ContentFileInfoFactory.class);
        when(ContentFileInfoFactory.createContentFileInfo(any(File.class))).thenReturn(contentFileInfo);

        MessageDigestGenerator mockDigest = mock(MessageDigestGenerator.class);
        whenNew(MessageDigestGenerator.class).withArguments(anyString()).thenReturn(mockDigest);
        when(mockDigest.calcDigestString(any(File.class))).thenReturn("sha256");

        when(mockFile.getName()).thenReturn("fileName");
        when(mockFile.getAbsolutePath()).thenReturn("mock path");

        //create object to test and inject required dependencies
View Full Code Here

Examples of org.rhq.core.util.MessageDigestGenerator.calcDigestString()

        verify(mockList, times(2)).size();
        verify(mockList, never()).get(anyInt());

        verify(result, times(2)).setPackageBits(any(PackageBits.class));
        MessageDigestGenerator digest = new MessageDigestGenerator(MessageDigestGenerator.SHA_256);
        verify(result).setSHA256(digest.calcDigestString(sampleContent));
        verify(result).setFileSize((long) sampleContent.getBytes().length);
        verify(result).setDisplayVersion(displayVersion);
    }

    /*
 
View Full Code Here

Examples of org.rhq.core.util.MessageDigestGenerator.calcDigestString()

        Manifest manifest = new Manifest(manifestStream);
        String actualSha256Attribute = manifest.getMainAttributes().getValue("RHQ-Sha256");
        manifestStream.close();

        MessageDigestGenerator digest = new MessageDigestGenerator(MessageDigestGenerator.SHA_256);
        String expectedSHA256 = digest.calcDigestString(sampleWithManifestWar);

        Assert.assertEquals(actualSha256Attribute, expectedSHA256);
        Assert.assertEquals(actualShaReturned, expectedSHA256);

        //cleanup resources created for this test
View Full Code Here

Examples of org.rhq.core.util.MessageDigestGenerator.calcDigestString()

        Manifest manifest = new Manifest(manifestStream);
        String actualSha256Attribute = manifest.getMainAttributes().getValue("RHQ-Sha256");
        manifestStream.close();

        MessageDigestGenerator digest = new MessageDigestGenerator(MessageDigestGenerator.SHA_256);
        String expectedSHA256 = digest.calcDigestString(sampleWithoutManifestWar);

        Assert.assertEquals(actualSha256Attribute, expectedSHA256);
        Assert.assertEquals(actualShaReturned, expectedSHA256);

        deleteRecursive(deploymentDirectory);
View Full Code Here

Examples of org.rhq.core.util.MessageDigestGenerator.calcDigestString()

        Assert.assertTrue(deploymentDirectory.exists(), "Deployment did not happen.");
        Assert.assertTrue(deploymentDirectory.isDirectory(), "Deployment directory is no longer a directory!!");
        Assert.assertFalse(deploymentFile.isDirectory(), "Deployment was exploded when it should not have been.");

        MessageDigestGenerator digest = new MessageDigestGenerator(MessageDigestGenerator.SHA_256);
        String expectedSHA256 = digest.calcDigestString(sampleWithoutManifestWar);
        String actualSHA256OfDeployment = digest.calcDigestString(deploymentFile);

        Assert.assertEquals(actualSHA256OfDeployment, expectedSHA256);
        Assert.assertEquals(actualShaReturned, expectedSHA256);
View Full Code Here

Examples of org.rhq.core.util.MessageDigestGenerator.calcDigestString()

        Assert.assertTrue(deploymentDirectory.isDirectory(), "Deployment directory is no longer a directory!!");
        Assert.assertFalse(deploymentFile.isDirectory(), "Deployment was exploded when it should not have been.");

        MessageDigestGenerator digest = new MessageDigestGenerator(MessageDigestGenerator.SHA_256);
        String expectedSHA256 = digest.calcDigestString(sampleWithoutManifestWar);
        String actualSHA256OfDeployment = digest.calcDigestString(deploymentFile);

        Assert.assertEquals(actualSHA256OfDeployment, expectedSHA256);
        Assert.assertEquals(actualShaReturned, expectedSHA256);

        //cleanup resources created for this test
View Full Code Here

Examples of org.rhq.core.util.MessageDigestGenerator.calcDigestString()

        //run code under test
        String actualShaReturned = objectUnderTest.getSHA(sampleWithoutManifestWar);

        //verify the results (Assert and mock verification)
        MessageDigestGenerator digest = new MessageDigestGenerator(MessageDigestGenerator.SHA_256);
        String expectedSHA256 = digest.calcDigestString(sampleWithoutManifestWar);

        //cleanup resources created for this test
        Assert.assertEquals(actualShaReturned, expectedSHA256);
    }
View Full Code Here

Examples of org.rhq.core.util.MessageDigestGenerator.calcDigestString()

            .thenReturn(mockJarFile);

        MessageDigestGenerator mockMessageDigestGenerator = mock(MessageDigestGenerator.class);
        PowerMockito.whenNew(MessageDigestGenerator.class).withParameterTypes(String.class).withArguments(anyString())
            .thenReturn(mockMessageDigestGenerator);
        when(mockMessageDigestGenerator.calcDigestString(any(File.class))).thenReturn("abcd1234");

        //create object to test and inject required dependencies
        JarContentDelegate objectUnderTest = new JarContentDelegate(mockDirectory, "jar");

        //run code under test
View Full Code Here

Examples of org.rhq.core.util.MessageDigestGenerator.calcDigestString()

    @Deprecated
    private String computeSHAForArchivedContent(File contentFile) {
        if (!contentFile.isDirectory()) {
            try {
                MessageDigestGenerator messageDigest = new MessageDigestGenerator(MessageDigestGenerator.SHA_256);
                return messageDigest.calcDigestString(contentFile);
            } catch (Exception ex) {
                log.error("Not able to compute SHA256 for " + contentFile.getPath() + " .");
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.