Package hudson.plugins.deploy

Source Code of hudson.plugins.deploy.PasswordProtectedAdapterCargoTest

package hudson.plugins.deploy;

import hudson.util.XStream2;
import org.hamcrest.CoreMatchers;
import org.junit.Assert;
import org.junit.Test;
import org.junit.matchers.JUnitMatchers;

public class PasswordProtectedAdapterCargoTest {
    @Test
    public void testDeserializeOldPlainPassword () {
        String plainPassword = "plain-password";
        String oldXml = "<hudson.plugins.deploy.glassfish.GlassFish3xAdapter><userName>manager</userName><password>"
            + plainPassword + "</password><home>/</home><hostname></hostname></hudson.plugins.deploy.glassfish.GlassFish3xAdapter>";
        XStream2 xs = new XStream2();

        PasswordProtectedAdapterCargo adapter = (PasswordProtectedAdapterCargo)xs.fromXML(oldXml);
        Assert.assertEquals(plainPassword, adapter.getPassword());
       
        String newXml = xs.toXML(adapter);
        Assert.assertThat("Password should be scrambled", newXml, CoreMatchers.not(JUnitMatchers.containsString(plainPassword)));
    }
}
TOP

Related Classes of hudson.plugins.deploy.PasswordProtectedAdapterCargoTest

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.