当前位置: 首页>>代码示例>>Java>>正文


Java Server.setUsername方法代码示例

本文整理汇总了Java中org.apache.maven.settings.Server.setUsername方法的典型用法代码示例。如果您正苦于以下问题:Java Server.setUsername方法的具体用法?Java Server.setUsername怎么用?Java Server.setUsername使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.maven.settings.Server的用法示例。


在下文中一共展示了Server.setUsername方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: test003UsernamePasswordLookup

import org.apache.maven.settings.Server; //导入方法依赖的package包/类
public void test003UsernamePasswordLookup()
    throws MojoExecutionException
{

    Settings settings = new Settings();
    Server server = new Server();
    server.setId( "somekey" );
    server.setUsername( "username" );
    server.setPassword( "password" );
    settings.addServer( server );

    mojo.setSettings( settings );

    // force a lookup of username
    mojo.setSettingsKey( "somekey" );
    mojo.setUsername( null );
    mojo.setPassword( null );

    mojo.execute();

    assertEquals( "username", mojo.getUsername() );
    assertEquals( "password", mojo.getPassword() );

}
 
开发者ID:mojohaus,项目名称:sql-maven-plugin,代码行数:25,代码来源:SqlExecMojoTest.java

示例2: addServers

import org.apache.maven.settings.Server; //导入方法依赖的package包/类
/**
 * Adds a list of server configurations to the maven settings object
 *
 * @param settings Maven Settings to append to
 * @param servers  Servers to add to the settings
 */
private void addServers(Settings settings, List<MavenSettingsServer> servers) {
    for (MavenSettingsServer server : servers) {
        Server serverToAdd = new Server();
        serverToAdd.setId(server.getId());

        String username = server.getUsername();
        String password = server.getPassword();

        if (StringUtils.isNotBlank(username)) {
            serverToAdd.setUsername(username);
        }
        if (StringUtils.isNotBlank(password)) {
            serverToAdd.setPassword(password);
        }
        settings.addServer(serverToAdd);
    }
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:24,代码来源:MavenServiceImpl.java

示例3: testAuthenticationHandling

import org.apache.maven.settings.Server; //导入方法依赖的package包/类
public void testAuthenticationHandling()
    throws Exception
{
    Server server = new Server();
    server.setId( "repository" );
    server.setUsername( "jason" );
    server.setPassword( "abc123" );

    ArtifactRepository repository =
        repositorySystem.createArtifactRepository( "repository", "http://foo", null, null, null );
    repositorySystem.injectAuthentication( Arrays.asList( repository ), Arrays.asList( server ) );
    Authentication authentication = repository.getAuthentication();
    assertNotNull( authentication );
    assertEquals( "jason", authentication.getUsername() );
    assertEquals( "abc123", authentication.getPassword() );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:17,代码来源:LegacyRepositorySystemTest.java

示例4: fetchesCredentialsFromMavenSettings

import org.apache.maven.settings.Server; //导入方法依赖的package包/类
/**
 * ServerCredentials can fetch credentials from Maven settings.
 * @throws Exception If something is wrong
 */
@Test
public void fetchesCredentialsFromMavenSettings() throws Exception {
    final String key = "AAAABBBBCCCCDDDDZ9Y1";
    final String secret = "AbCdEfGhAbCdEfG/AbCdE7GhAbCdE9Gh+bCdEfGh";
    final Server server = new Server();
    server.setUsername(key);
    server.setPassword(secret);
    final String name = "srv1";
    server.setId(name);
    final Settings settings = new Settings();
    settings.addServer(server);
    final AWSCredentials creds = new ServerCredentials(settings, name);
    MatcherAssert.assertThat(
        creds.getAWSAccessKeyId(),
        Matchers.equalTo(key)
    );
    MatcherAssert.assertThat(
        creds.getAWSSecretKey(),
        Matchers.equalTo(secret)
    );
}
 
开发者ID:jcabi,项目名称:jcabi-beanstalk-maven-plugin,代码行数:26,代码来源:ServerCredentialsTest.java

示例5: velocityTemplateCorrectlyBuildsSettingsXml

import org.apache.maven.settings.Server; //导入方法依赖的package包/类
/**
 * DeployMojo can generate correct settings.xml file.
 * @throws Exception If something is wrong
 */
@Test
public void velocityTemplateCorrectlyBuildsSettingsXml() throws Exception {
    final Server server = new Server();
    server.setUsername("john");
    server.setPassword("xxx");
    final Settings settings = new Settings();
    settings.addServer(server);
    final String nspace = "http://maven.apache.org/SETTINGS/1.0.0";
    MatcherAssert.assertThat(
        new VelocityPage(
            "com/jcabi/heroku/maven/plugin/settings.xml.vm"
        ).set("settings", settings).toString(),
        Matchers.allOf(
            XhtmlMatchers.hasXPath(
                "//ns1:server[ns1:username='john' and ns1:password='xxx']",
                nspace
            ),
            XhtmlMatchers.hasXPath(
                "//ns1:server[ns1:username='john' and not(ns1:privateKey)]",
                nspace
            )
        )
    );
}
 
开发者ID:jcabi,项目名称:jcabi-heroku-maven-plugin,代码行数:29,代码来源:DeployMojoTest.java


注:本文中的org.apache.maven.settings.Server.setUsername方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。