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


Java Server类代码示例

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


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

示例1: updateAppRuntime

import org.apache.maven.settings.Server; //导入依赖的package包/类
@Test
public void updateAppRuntime() throws Exception {
    final SiteInner siteInner = mock(SiteInner.class);
    doReturn("app,linux").when(siteInner).kind();
    final WithCredentials withCredentials = mock(WithCredentials.class);
    final Update update = mock(Update.class);
    doReturn(withCredentials).when(update).withPrivateRegistryImage(null, null);
    final WebApp app = mock(WebApp.class);
    doReturn(siteInner).when(app).inner();
    doReturn(update).when(app).update();

    final ContainerSetting containerSetting = new ContainerSetting();
    containerSetting.setServerId("serverId");
    doReturn(containerSetting).when(mojo).getContainerSettings();

    final Server server = mock(Server.class);
    final Settings settings = mock(Settings.class);
    doReturn(server).when(settings).getServer(anyString());
    doReturn(settings).when(mojo).getSettings();

    handler.updateAppRuntime(app);

    verify(update, times(1)).withPrivateRegistryImage(null, null);
    verify(server, times(1)).getUsername();
    verify(server, times(1)).getPassword();
}
 
开发者ID:Microsoft,项目名称:azure-maven-plugins,代码行数:27,代码来源:PrivateRegistryRuntimeHandlerImplTest.java

示例2: updateAppRuntime

import org.apache.maven.settings.Server; //导入依赖的package包/类
@Test
public void updateAppRuntime() throws Exception {
    final WebApp app = mock(WebApp.class);
    final SiteInner siteInner = mock(SiteInner.class);
    doReturn("app,linux").when(siteInner).kind();
    doReturn(siteInner).when(app).inner();
    final Update update = mock(Update.class);
    final WithCredentials withCredentials = mock(WithCredentials.class);
    doReturn(withCredentials).when(update).withPrivateDockerHubImage(null);
    doReturn(update).when(app).update();

    final ContainerSetting containerSetting = new ContainerSetting();
    containerSetting.setServerId("serverId");
    doReturn(containerSetting).when(mojo).getContainerSettings();

    final Server server = mock(Server.class);
    final Settings settings = mock(Settings.class);
    doReturn(server).when(settings).getServer(anyString());
    doReturn(settings).when(mojo).getSettings();

    handler.updateAppRuntime(app);

    verify(update, times(1)).withPrivateDockerHubImage(null);
    verify(server, times(1)).getUsername();
    verify(server, times(1)).getPassword();
}
 
开发者ID:Microsoft,项目名称:azure-maven-plugins,代码行数:27,代码来源:PrivateDockerHubRuntimeHandlerImplTest.java

示例3: getAuthObjFromServerId

import org.apache.maven.settings.Server; //导入依赖的package包/类
/**
 * Get Authenticated object by referencing server definition in Maven settings.xml
 *
 * @param settings Settings object
 * @param serverId Server Id to search in settings.xml
 * @return Authenticated object if configurations are correct; otherwise return null.
 */
protected Authenticated getAuthObjFromServerId(final Settings settings, final String serverId) {
    if (StringUtils.isEmpty(serverId)) {
        getLog().debug(SERVER_ID_NOT_CONFIG);
        return null;
    }

    final Server server = Utils.getServer(settings, serverId);
    if (server == null) {
        getLog().error(SERVER_ID_NOT_FOUND + serverId);
        return null;
    }

    final ApplicationTokenCredentials credential = getAppTokenCredentialsFromServer(server);
    if (credential == null) {
        getLog().error(AZURE_AUTH_INVALID + serverId);
        return null;
    }

    final Authenticated auth = azureConfigure().authenticate(credential);
    if (auth != null) {
        getLog().info(AUTH_WITH_SERVER_ID + serverId);
    }
    return auth;
}
 
开发者ID:Microsoft,项目名称:azure-maven-plugins,代码行数:32,代码来源:AzureAuthHelper.java

示例4: getValueFromServerConfiguration

import org.apache.maven.settings.Server; //导入依赖的package包/类
/**
 * Get string value from server configuration section in settings.xml.
 *
 * @param server Server object.
 * @param key    Key string.
 * @return String value if key exists; otherwise, return null.
 */
public static String getValueFromServerConfiguration(final Server server, final String key) {
    if (server == null) {
        return null;
    }

    final Xpp3Dom configuration = (Xpp3Dom) server.getConfiguration();
    if (configuration == null) {
        return null;
    }

    final Xpp3Dom node = configuration.getChild(key);
    if (node == null) {
        return null;
    }

    return node.getValue();
}
 
开发者ID:Microsoft,项目名称:azure-maven-plugins,代码行数:25,代码来源:Utils.java

示例5: configureJsch

import org.apache.maven.settings.Server; //导入依赖的package包/类
protected final void configureJsch() {
	if (!disableSshAgent) {
		if (serverId != null) {
			final Server server = settings.getServer(serverId);
			if (server != null) {
				privateKey = privateKey == null ? server.getPrivateKey() : privateKey;
				passphrase = passphrase == null ? server.getPassphrase() : passphrase;
			} else {
				getLog().warn(format("No server configuration in Maven settings found with id %s", serverId));
			}
		}

		JschConfigSessionFactory
				.setInstance(new SshAgentSessionFactory(getLog(), knownHosts, privateKey, passphrase));
	}
}
 
开发者ID:SourcePond,项目名称:release-maven-plugin-parent,代码行数:17,代码来源:NextMojo.java

示例6: getAwsKeyPair

import org.apache.maven.settings.Server; //导入依赖的package包/类
static AwsKeyPair getAwsKeyPair(String serverId, String awsAccessKey, String awsSecretAccessKey,
        Settings settings, SettingsDecrypter decrypter) throws MojoExecutionException {
    final AwsKeyPair keys;
    if (serverId != null) {
        Server server = settings.getServer(serverId);
        if (server == null) {
            throw new MojoExecutionException("serverId not found in settings: " + serverId);
        } else {
            SettingsDecryptionRequest request = new DefaultSettingsDecryptionRequest(server);
            SettingsDecryptionResult result = decrypter.decrypt(request);
            keys = new AwsKeyPair(result.getServer().getUsername(),
                    result.getServer().getPassword());
        }
    } else {
        keys = new AwsKeyPair(awsAccessKey, awsSecretAccessKey);
    }
    return keys;
}
 
开发者ID:davidmoten,项目名称:aws-maven-plugin,代码行数:19,代码来源:Util.java

示例7: test002DefaultUsernamePassword

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

    Settings settings = new Settings();
    Server server = new Server();
    settings.addServer( server );

    mojo.setSettings( settings );

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

    mojo.execute();

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

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

示例8: 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

示例9: 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

示例10: loadInfosFromSettings

import org.apache.maven.settings.Server; //导入依赖的package包/类
/**
 * Load username password from settings.
 */
private void loadInfosFromSettings( ScmProviderRepositoryWithHost repo )
{
    if ( username == null || password == null )
    {
        String host = repo.getHost();

        int port = repo.getPort();

        if ( port > 0 )
        {
            host += ":" + port;
        }

        Server server = this.settings.getServer( host );

        if ( server != null )
        {
            setPasswordIfNotEmpty( repo, decrypt( server.getPassword(), host ) );

            setUserIfNotEmpty( repo, server.getUsername() );
        }
    }
}
 
开发者ID:mojohaus,项目名称:buildnumber-maven-plugin,代码行数:27,代码来源:AbstractScmMojo.java

示例11: getRemoteRepoFromDeployment

import org.apache.maven.settings.Server; //导入依赖的package包/类
private RemoteRepository getRemoteRepoFromDeployment(final DeploymentRepository repo,
                                                     final MavenEmbedder embedder) {
    RemoteRepository.Builder remoteRepoBuilder = new RemoteRepository.Builder(repo.getId(),
                                                                              repo.getLayout(),
                                                                              repo
                                                                                      .getUrl())
            .setSnapshotPolicy(new RepositoryPolicy(true,
                                                    RepositoryPolicy.UPDATE_POLICY_DAILY,
                                                    RepositoryPolicy.CHECKSUM_POLICY_WARN))
            .setReleasePolicy(new RepositoryPolicy(true,
                                                   RepositoryPolicy.UPDATE_POLICY_ALWAYS,
                                                   RepositoryPolicy.CHECKSUM_POLICY_WARN));

    Settings settings = MavenSettings.getSettings();
    Server server = settings.getServer(repo.getId());

    if (server != null) {
        Authentication authentication = embedder.getMavenSession().getRepositorySession()
                .getAuthenticationSelector()
                .getAuthentication(remoteRepoBuilder.build());
        remoteRepoBuilder.setAuthentication(authentication);
    }

    return remoteRepoBuilder.build();
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:26,代码来源:DistributionManagementArtifactRepository.java

示例12: convertToArtifactRepository

import org.apache.maven.settings.Server; //导入依赖的package包/类
private RemoteRepository convertToArtifactRepository(final org.apache.maven.artifact.repository.ArtifactRepository artifactRepository) {
    final MavenEmbedder mavenEmbedder = MavenProjectLoader.newMavenEmbedder(MavenSettings.getSettings().isOffline());
    final RemoteRepository.Builder remoteRepoBuilder = new RemoteRepository.Builder(artifactRepository.getId(),
                                                                                    artifactRepository.getLayout().getId(),
                                                                                    artifactRepository.getUrl())
            .setSnapshotPolicy(new RepositoryPolicy(true,
                                                    RepositoryPolicy.UPDATE_POLICY_DAILY,
                                                    RepositoryPolicy.CHECKSUM_POLICY_WARN))
            .setReleasePolicy(new RepositoryPolicy(true,
                                                   RepositoryPolicy.UPDATE_POLICY_ALWAYS,
                                                   RepositoryPolicy.CHECKSUM_POLICY_WARN));

    final Settings settings = MavenSettings.getSettings();
    final Server server = settings.getServer(artifactRepository.getId());

    if (server != null) {
        final Authentication authentication = mavenEmbedder
                .getMavenSession()
                .getRepositorySession()
                .getAuthenticationSelector()
                .getAuthentication(remoteRepoBuilder.build());
        remoteRepoBuilder.setAuthentication(authentication);
    }

    return remoteRepoBuilder.build();
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:27,代码来源:ProjectRepositoryResolverImpl.java

示例13: getRemoteRepoFromDeployment

import org.apache.maven.settings.Server; //导入依赖的package包/类
private static RemoteRepository getRemoteRepoFromDeployment(final DeploymentRepository deploymentRepository,
                                                            final RepositorySystemSession mavenSession) {
    final RemoteRepository.Builder remoteRepoBuilder = new RemoteRepository.Builder(deploymentRepository.getId(),
                                                                                    deploymentRepository.getLayout(),
                                                                                    deploymentRepository.getUrl())
            .setSnapshotPolicy(new RepositoryPolicy(true,
                                                    RepositoryPolicy.UPDATE_POLICY_DAILY,
                                                    RepositoryPolicy.CHECKSUM_POLICY_WARN))
            .setReleasePolicy(new RepositoryPolicy(true,
                                                   RepositoryPolicy.UPDATE_POLICY_DAILY,
                                                   RepositoryPolicy.CHECKSUM_POLICY_WARN));

    final Settings settings = MavenSettings.getSettings();
    final Server server = settings.getServer(deploymentRepository.getId());

    if (server != null) {
        final Authentication authentication = mavenSession
                .getAuthenticationSelector()
                .getAuthentication(remoteRepoBuilder.build());
        remoteRepoBuilder.setAuthentication(authentication);
    }

    return remoteRepoBuilder.build();
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:25,代码来源:RepositoryResolverTestUtils.java

示例14: execute

import org.apache.maven.settings.Server; //导入依赖的package包/类
@Override
public void execute(FrontendPluginFactory factory) throws InstallationException {
    ProxyConfig proxyConfig = MojoUtils.getProxyConfig(this.session, this.decrypter);
    Server server = MojoUtils.decryptServer(this.serverId, this.session, this.decrypter);
    if (null != server) {
        factory.getNodeInstaller(proxyConfig).setNodeDownloadRoot(this.nodeDownloadRoot)
            .setNodeVersion(this.nodeVersion).setPassword(server.getPassword())
            .setUserName(server.getUsername()).install();
        factory.getYarnInstaller(proxyConfig).setYarnDownloadRoot(this.yarnDownloadRoot)
            .setYarnVersion(this.yarnVersion).setUserName(server.getUsername())
            .setPassword(server.getPassword()).install();
    } else {
        factory.getNodeInstaller(proxyConfig).setNodeDownloadRoot(this.nodeDownloadRoot)
            .setNodeVersion(this.nodeVersion).install();
        factory.getYarnInstaller(proxyConfig).setYarnDownloadRoot(this.yarnDownloadRoot)
            .setYarnVersion(this.yarnVersion).install();
    }
}
 
开发者ID:eirslett,项目名称:frontend-maven-plugin,代码行数:19,代码来源:InstallNodeAndYarnMojo.java

示例15: 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


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