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


Java ReflectionUtils.setVariableValueInObject方法代码示例

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


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

示例1: doExecute

import org.codehaus.plexus.util.ReflectionUtils; //导入方法依赖的package包/类
@Test
public void doExecute() throws Exception {
    final PackageMojo mojo = getMojoFromPom();
    final PackageMojo mojoSpy = spy(mojo);
    ReflectionUtils.setVariableValueInObject(mojoSpy, "finalName", "artifact-0.1.0");
    doReturn(mock(AnnotationHandler.class)).when(mojoSpy).getAnnotationHandler();
    doReturn(ClasspathHelper.forPackage("com.microsoft.azure.maven.function.handlers").toArray()[0])
            .when(mojoSpy)
            .getTargetClassUrl();
    doReturn("target/azure-functions").when(mojoSpy).getDeploymentStageDirectory();
    doReturn("target").when(mojoSpy).getBuildDirectoryAbsolutePath();
    doReturn(mock(MavenProject.class)).when(mojoSpy).getProject();
    doReturn(mock(MavenSession.class)).when(mojoSpy).getSession();
    doReturn(mock(MavenResourcesFiltering.class)).when(mojoSpy).getMavenResourcesFiltering();

    mojoSpy.doExecute();
}
 
开发者ID:Microsoft,项目名称:azure-maven-plugins,代码行数:18,代码来源:PackageMojoTest.java

示例2: doExecute

import org.codehaus.plexus.util.ReflectionUtils; //导入方法依赖的package包/类
@Test
public void doExecute() throws Exception {
    final AddMojo mojo = getMojoFromPom();
    final Settings settings = new Settings();
    settings.setInteractiveMode(false);
    ReflectionUtils.setVariableValueInObject(mojo, "basedir", new File("target/test"));
    ReflectionUtils.setVariableValueInObject(mojo, "settings", settings);
    mojo.setFunctionTemplate("HttpTrigger");
    mojo.setFunctionName("New-Function");
    mojo.setFunctionPackageName("com.microsoft.azure");

    final File newFunctionFile = new File("target/test/src/main/java/com/microsoft/azure/New_Function.java");
    newFunctionFile.delete();

    mojo.doExecute();

    assertTrue(newFunctionFile.exists());
}
 
开发者ID:Microsoft,项目名称:azure-maven-plugins,代码行数:19,代码来源:AddMojoTest.java

示例3: ProxyServerMitmManager

import org.codehaus.plexus.util.ReflectionUtils; //导入方法依赖的package包/类
public ProxyServerMitmManager(Authority authority, boolean trustAllServers,
		boolean sendCerts) throws RootCertificateException {
	try {
		sslEngineSource = new BouncyCastleSslEngineSource(authority,
				trustAllServers, sendCerts);
		SSLContext sslContext = (SSLContext) ReflectionUtils
				.getValueIncludingSuperclasses("sslContext",
						sslEngineSource);
		SSLContextImpl sslContextImpl = (SSLContextImpl) ReflectionUtils
				.getValueIncludingSuperclasses("contextSpi", sslContext);
		ReflectionUtils.setVariableValueInObject(sslContextImpl,
				"trustManager", new InsecureX509ExtendedTrustManager());
	} catch (final Exception e) {
		throw new RootCertificateException(
				"Errors during assembling root CA.", e);
	}
}
 
开发者ID:eBay,项目名称:ServiceCOLDCache,代码行数:18,代码来源:ProxyServerMitmManager.java

示例4: execute

import org.codehaus.plexus.util.ReflectionUtils; //导入方法依赖的package包/类
public void execute()
    throws MojoExecutionException, MojoFailureException
{
    try
    {
        AntRunMojo antRunMojo = new AntRunMojo();
        antRunMojo.setLog( getLog() );
        ReflectionUtils.setVariableValueInObject( antRunMojo, "project", session.getCurrentProject() );
        ReflectionUtils.setVariableValueInObject( antRunMojo, "target", getConfiguration() );
        ReflectionUtils.setVariableValueInObject( antRunMojo, "localRepository", localRepository );
        ReflectionUtils.setVariableValueInObject( antRunMojo, "versionsPropertyName",
                                                  "maven.project.dependencies.versions" );
        antRunMojo.execute();
    }
    catch ( Exception e )
    {
        throw new MojoExecutionException( "There was an error creating the AntRun task.", e );
    }
}
 
开发者ID:frincon,项目名称:openeos,代码行数:20,代码来源:AbstractHibernateMojo.java

示例5: createProvider

import org.codehaus.plexus.util.ReflectionUtils; //导入方法依赖的package包/类
private XmlBasedTestDataProvider createProvider(AludraTestConfig config) throws Exception {
    XmlBasedTestDataProvider provider = new XmlBasedTestDataProvider();
    if (config == null) {
        config = new AludraTestConfigImpl();
        DefaultConfigurator configurator = new DefaultConfigurator();
        configurator.configure(config);
    }

    Map<String, ScriptLibrary> libs = new HashMap<String, ScriptLibrary>();

    DefaultScriptLibrary lib = new DefaultScriptLibrary();
    ReflectionUtils.setVariableValueInObject(lib, "aludraConfig", config);
    libs.put("default", lib);

    ReflectionUtils.setVariableValueInObject(provider, "aludraConfig", config);
    ReflectionUtils.setVariableValueInObject(provider, "scriptLibraries", libs);
    return provider;
}
 
开发者ID:AludraTest,项目名称:aludratest,代码行数:19,代码来源:XmlBasedTestDataProviderTest.java

示例6: getTelemetryProperties

import org.codehaus.plexus.util.ReflectionUtils; //导入方法依赖的package包/类
@Test
public void getTelemetryProperties() throws Exception {
    final DeployMojo mojo = getMojoFromPom("/pom-linux.xml");
    ReflectionUtils.setVariableValueInObject(mojo, "plugin", plugin);

    final Map map = mojo.getTelemetryProperties();

    assertEquals(10, map.size());
    assertTrue(map.containsKey(JAVA_VERSION_KEY));
    assertTrue(map.containsKey(JAVA_WEB_CONTAINER_KEY));
    assertTrue(map.containsKey(DOCKER_IMAGE_TYPE_KEY));
    assertTrue(map.containsKey(DEPLOYMENT_TYPE_KEY));
}
 
开发者ID:Microsoft,项目名称:azure-maven-plugins,代码行数:14,代码来源:DeployMojoTest.java

示例7: setUp

import org.codehaus.plexus.util.ReflectionUtils; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    doReturn(PLUGIN_NAME).when(plugin).getArtifactId();
    doReturn(PLUGIN_VERSION).when(plugin).getVersion();
    doReturn("target").when(buildDirectory).getAbsolutePath();
    ReflectionUtils.setVariableValueInObject(mojo, "subscriptionId", SUBSCRIPTION_ID);
    ReflectionUtils.setVariableValueInObject(mojo, "allowTelemetry", false);
    ReflectionUtils.setVariableValueInObject(mojo, "failsOnError", true);
}
 
开发者ID:Microsoft,项目名称:azure-maven-plugins,代码行数:11,代码来源:AbstractAzureMojoTest.java

示例8: getUserAgentWhenTelemetryAllowed

import org.codehaus.plexus.util.ReflectionUtils; //导入方法依赖的package包/类
@Test
public void getUserAgentWhenTelemetryAllowed() throws IllegalAccessException {
    ReflectionUtils.setVariableValueInObject(mojo, "allowTelemetry", true);
    final String userAgent = mojo.getUserAgent();
    assertTrue(StringUtils.contains(userAgent, PLUGIN_NAME));
    assertTrue(StringUtils.contains(userAgent, PLUGIN_VERSION));
    assertTrue(StringUtils.contains(userAgent, mojo.getInstallationId()));
    assertTrue(StringUtils.contains(userAgent, mojo.getSessionId()));
}
 
开发者ID:Microsoft,项目名称:azure-maven-plugins,代码行数:10,代码来源:AbstractAzureMojoTest.java

示例9: getAuthType

import org.codehaus.plexus.util.ReflectionUtils; //导入方法依赖的package包/类
@Test
public void getAuthType() throws Exception {
    assertEquals("Unknown", mojo.getAuthType());

    doReturn("serverId").when(authenticationSetting).getServerId();
    doReturn(null).when(authenticationSetting).getFile();
    assertEquals("ServerId", mojo.getAuthType());

    doReturn(null).when(authenticationSetting).getServerId();
    doReturn(new File("/pom.xml")).when(authenticationSetting).getFile();
    assertEquals("AuthFile", mojo.getAuthType());

    ReflectionUtils.setVariableValueInObject(mojo, "authentication", null);
    assertEquals("AzureCLI", mojo.getAuthType());
}
 
开发者ID:Microsoft,项目名称:azure-maven-plugins,代码行数:16,代码来源:AbstractAzureMojoTest.java

示例10: getRunFunctionCommandWithInputOnWindows

import org.codehaus.plexus.util.ReflectionUtils; //导入方法依赖的package包/类
@Test
public void getRunFunctionCommandWithInputOnWindows() throws Exception {
    final RunMojo mojo = getMojoFromPom();
    ReflectionUtils.setVariableValueInObject(mojo, "targetFunction", "httpTrigger");
    ReflectionUtils.setVariableValueInObject(mojo, "functionInputString", "input");
    final RunMojo mojoSpy = spy(mojo);
    doReturn("target").when(mojoSpy).getDeploymentStageDirectory();
    doReturn(true).when(mojoSpy).isWindows();

    final String[] command = mojoSpy.getRunFunctionCommand();

    assertEquals(3, command.length);
    assertEquals("cd /D target && func function run httpTrigger --no-interactive -c input", command[2]);
}
 
开发者ID:Microsoft,项目名称:azure-maven-plugins,代码行数:15,代码来源:RunMojoTest.java

示例11: getRunFunctionCommandWithInputFileOnWindows

import org.codehaus.plexus.util.ReflectionUtils; //导入方法依赖的package包/类
@Test
public void getRunFunctionCommandWithInputFileOnWindows() throws Exception {
    final RunMojo mojo = getMojoFromPom();
    ReflectionUtils.setVariableValueInObject(mojo, "targetFunction", "httpTrigger");
    ReflectionUtils.setVariableValueInObject(mojo, "functionInputFile", new File("pom.xml"));
    final RunMojo mojoSpy = spy(mojo);
    doReturn("target").when(mojoSpy).getDeploymentStageDirectory();
    doReturn(true).when(mojoSpy).isWindows();

    final String[] command = mojoSpy.getRunFunctionCommand();

    assertEquals(3, command.length);
    assertTrue(command[2].startsWith("cd /D target && func function run httpTrigger --no-interactive -f"));
}
 
开发者ID:Microsoft,项目名称:azure-maven-plugins,代码行数:15,代码来源:RunMojoTest.java

示例12: getRunFunctionCommandWithInputFileOnLinux

import org.codehaus.plexus.util.ReflectionUtils; //导入方法依赖的package包/类
@Test
public void getRunFunctionCommandWithInputFileOnLinux() throws Exception {
    final RunMojo mojo = getMojoFromPom();
    ReflectionUtils.setVariableValueInObject(mojo, "targetFunction", "httpTrigger");
    ReflectionUtils.setVariableValueInObject(mojo, "functionInputFile", new File("pom.xml"));
    final RunMojo mojoSpy = spy(mojo);
    doReturn("target").when(mojoSpy).getDeploymentStageDirectory();
    doReturn(false).when(mojoSpy).isWindows();

    final String[] command = mojoSpy.getRunFunctionCommand();

    assertEquals(3, command.length);
    assertTrue(command[2].startsWith("cd target; func function run httpTrigger --no-interactive -f"));
}
 
开发者ID:Microsoft,项目名称:azure-maven-plugins,代码行数:15,代码来源:RunMojoTest.java

示例13: getRunFunctionCommandWithInputOnLinux

import org.codehaus.plexus.util.ReflectionUtils; //导入方法依赖的package包/类
@Test
public void getRunFunctionCommandWithInputOnLinux() throws Exception {
    final RunMojo mojo = getMojoFromPom();
    ReflectionUtils.setVariableValueInObject(mojo, "targetFunction", "httpTrigger");
    ReflectionUtils.setVariableValueInObject(mojo, "functionInputString", "input");
    final RunMojo mojoSpy = spy(mojo);
    doReturn("target").when(mojoSpy).getDeploymentStageDirectory();
    doReturn(false).when(mojoSpy).isWindows();

    final String[] command = mojoSpy.getRunFunctionCommand();

    assertEquals(3, command.length);
    assertEquals("cd target; func function run httpTrigger --no-interactive -c input", command[2]);
}
 
开发者ID:Microsoft,项目名称:azure-maven-plugins,代码行数:15,代码来源:RunMojoTest.java

示例14: getScriptFilePath

import org.codehaus.plexus.util.ReflectionUtils; //导入方法依赖的package包/类
@Test
public void getScriptFilePath() throws Exception {
    final PackageMojo mojo = getMojoFromPom();
    final PackageMojo mojoSpy = spy(mojo);
    ReflectionUtils.setVariableValueInObject(mojoSpy, "finalName", "artifact-0.1.0");

    final String finalName = mojoSpy.getScriptFilePath();

    assertEquals(Paths.get("..", "artifact-0.1.0.jar").toString(), finalName);
}
 
开发者ID:Microsoft,项目名称:azure-maven-plugins,代码行数:11,代码来源:PackageMojoTest.java

示例15: doExecuteWithInvalidFunctionName

import org.codehaus.plexus.util.ReflectionUtils; //导入方法依赖的package包/类
@Test(expected = MojoFailureException.class)
public void doExecuteWithInvalidFunctionName() throws Exception {
    final AddMojo mojo = getMojoFromPom();
    final Settings settings = new Settings();
    settings.setInteractiveMode(false);
    ReflectionUtils.setVariableValueInObject(mojo, "basedir", new File("target/test"));
    ReflectionUtils.setVariableValueInObject(mojo, "settings", settings);
    mojo.setFunctionTemplate("HttpTrigger");
    mojo.setFunctionName("$NewFunction");
    mojo.setFunctionPackageName("com.microsoft.azure");

    mojo.doExecute();
}
 
开发者ID:Microsoft,项目名称:azure-maven-plugins,代码行数:14,代码来源:AddMojoTest.java


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