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


Java ResourceExtractor类代码示例

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


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

示例1: setUpProject

import org.apache.maven.it.util.ResourceExtractor; //导入依赖的package包/类
@Before
public void setUpProject() throws IOException, VerificationException {
    assumeTrue("Set the M2_HOME environment variable", System.getenv("M2_HOME") != null);
    assumeTrue("Run from Maven or set the project.version system property", System.getProperty("project.version") != null);

    File projectDir = ResourceExtractor.extractResourcePath(getClass(), "/testing-project", tmp.getRoot(), true);
    testingProject.prepare(projectDir.toPath());

    verifier = new Verifier(projectDir.getAbsolutePath(), true);
    verifier.setForkJvm(true);

    String settingsXml = System.getProperty("org.apache.maven.user-settings");
    if (settingsXml != null && new File(settingsXml).isFile()) {
        verifier.addCliOption("-s");
        verifier.addCliOption(settingsXml);
    }

    logPath = Paths.get(verifier.getBasedir()).resolve(verifier.getLogFileName());
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:20,代码来源:MavenPluginTest.java

示例2: shouldAskForTheNotImplementedVersionOfTheSpecs

import org.apache.maven.it.util.ResourceExtractor; //导入依赖的package包/类
@Test
public void shouldAskForTheNotImplementedVersionOfTheSpecs() throws IOException, VerificationException {
    context.checking(new HandlerExpectations() {
        {
            this.withUrl = true;
            expectWithoutPageDownload();
            atLeast(1).of(handler).getRenderedSpecification("login", "password", new Vector<Object>() {{
                add("SPACE KEY");add("PAGE Executable");add(Boolean.TRUE);add(Boolean.FALSE);
            }});
            will(returnValue(specification()));
            atLeast(1).of(handler).getRenderedSpecification("login", "password", new Vector<Object>() {{
                add("SPACE KEY");add("SUBPAGE IMPLEMENTED");add(Boolean.TRUE);add(Boolean.FALSE);
            }});
            will(returnValue(specification()));
        }
    });

    File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/test-gp-run-atlrepo");
    testLaunchingMaven(testDir, new ArrayList<String>(), "integration-test");
}
 
开发者ID:strator-dev,项目名称:greenpepper,代码行数:21,代码来源:MavenPluginWithAtlassianRepoTest.java

示例3: shouldAskForTheNotImplementedVersionOfTheSpecsWOAuth

import org.apache.maven.it.util.ResourceExtractor; //导入依赖的package包/类
@Test
public void shouldAskForTheNotImplementedVersionOfTheSpecsWOAuth() throws IOException, VerificationException {
    context.checking(new HandlerExpectations() {
        {
            this.withUrl = true;
            expectWithoutPageDownload();
            atLeast(1).of(handler).getRenderedSpecification("", "", new Vector<Object>() {{
                add("SPACE KEY");add("PAGE Executable");add(Boolean.TRUE);add(Boolean.FALSE);
            }});
            will(returnValue(specification()));
            atLeast(1).of(handler).getRenderedSpecification("", "", new Vector<Object>() {{
                add("SPACE KEY");add("SUBPAGE IMPLEMENTED");add(Boolean.TRUE);add(Boolean.FALSE);
            }});
            will(returnValue(specification()));
        }
    });

    File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/test-gp-run-atlrepo-noauth");
    testLaunchingMaven(testDir, new ArrayList<String>(), "integration-test");
}
 
开发者ID:strator-dev,项目名称:greenpepper,代码行数:21,代码来源:MavenPluginWithAtlassianRepoTest.java

示例4: shouldNotHangs_issue95

import org.apache.maven.it.util.ResourceExtractor; //导入依赖的package包/类
@Test
public void shouldNotHangs_issue95() throws IOException, VerificationException {
    context.checking(new HandlerExpectations() {
        {
            this.withUrl = true;
            expectWithoutPageDownload();
            atLeast(1).of(handler).getRenderedSpecification("login", "password", new Vector<Object>() {{
                add("SPACE KEY");add("PAGE Executable");add(Boolean.TRUE);add(Boolean.FALSE);
            }});
            will(returnValue(FileUtils.readFileToString(
                    FileUtils.toFile(getClass().getResource("/issue95-global-exceptions-hangs/src/specs/count-1.html")))));
            atLeast(1).of(handler).getRenderedSpecification("login", "password", new Vector<Object>() {{
                add("SPACE KEY");add("SUBPAGE IMPLEMENTED");add(Boolean.TRUE);add(Boolean.FALSE);
            }});
            will(returnValue(specification()));
        }
    });

    File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/issue95-global-exceptions-hangs");
    Verifier verifier = testLaunchingMavenWithErrors(testDir, new ArrayList<String>(), "integration-test");
    verifier.verifyTextInLog("PAGE Executable (Repository: atlrepo) (1 tests: 0 right, 0 wrong, 0 ignored, 1 exception(s))");

}
 
开发者ID:strator-dev,项目名称:greenpepper,代码行数:24,代码来源:MavenPluginWithAtlassianRepoTest.java

示例5: createVerifier

import org.apache.maven.it.util.ResourceExtractor; //导入依赖的package包/类
private static Verifier createVerifier(final String testFolderName) throws IOException, VerificationException {
    final File testDir = ResourceExtractor.simpleExtractResources(DummyApiIT.class, "/" + testFolderName);
    final File settingsXml = new File(testDir.getParent(), "settings.xml");

    // During release:prepare the system property maven.repo.local is set (probably
    // for some forked process).
    // Verifier gives precedence to the system property (correctly IMHO), rather than
    // the setting in settings.xml, which results in an incorrect local repository
    // during release:prepare and thus test failures. To work around this issue, we
    // temporarily clear the system property during the creation of the Verifier instance.
    final String originalLocalRepo = System.getProperty(MAVEN_REPO_LOCAL);
    System.clearProperty(MAVEN_REPO_LOCAL);
    final Verifier verifier= new Verifier(testDir.getAbsolutePath(), settingsXml.getAbsolutePath());
    verifier.setCliOptions(asList("-s", settingsXml.getAbsolutePath()));
    if (originalLocalRepo != null) {
        System.setProperty(MAVEN_REPO_LOCAL, originalLocalRepo);
    }
    return verifier;
}
 
开发者ID:code-distillery,项目名称:baselining-maven-plugin,代码行数:20,代码来源:DummyApiIT.java

示例6: envVarPathConfiguration

import org.apache.maven.it.util.ResourceExtractor; //导入依赖的package包/类
@Test
public void envVarPathConfiguration() throws Exception
{
    final File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/compute-pi-cxxtest-test" );

    Verifier verifier = new Verifier( testDir.getAbsolutePath() );
    addPropertiesToVerifier( verifier );
    // As we can't know a real location put a fake one and check the error message
    verifier.setEnvironmentVariable( "CXXTEST_HOME", "my_fake_path" );

    try
    {
        verifier.executeGoal( GROUPID + ":" + ARTIFACTID + ":" + CxxTestGenMojo.MOJO_NAME );
        fail();
    }
    catch ( VerificationException ve )
    {
        verifier.verifyTextInLog( "my_fake_path" );
    }
}
 
开发者ID:andi12,项目名称:msbuild-maven-plugin,代码行数:21,代码来源:MavenITCxxTestMojoTest.java

示例7: testCxxTestGenerateNoUpdate

import org.apache.maven.it.util.ResourceExtractor; //导入依赖的package包/类
@Test
public void testCxxTestGenerateNoUpdate() throws Exception
{
    final File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/compute-pi-cxxtest-test" );
    final File outputFile = calculateAndDeleteTestRunnerCpp( "/compute-pi-cxxtest-test/compute-pi-test/" );

    Verifier verifier = new Verifier( testDir.getAbsolutePath() );
    addPropertiesToVerifier( verifier );
    verifier.getSystemProperties().setProperty( MSBuildMojoITHelper.MSBUILD_PLUGIN_TOOLS_ENABLE, "true" );
    
    verifier.executeGoal( GROUPID + ":" + ARTIFACTID + ":" + CxxTestGenMojo.MOJO_NAME );
    verifier.verifyErrorFreeLog();
    assertTrue( "Test runner not generated", outputFile.exists() );
    long lastUpdate = outputFile.lastModified();
    verifier.resetStreams();

    verifier.executeGoal( GROUPID + ":" + ARTIFACTID + ":" + CxxTestGenMojo.MOJO_NAME );
    verifier.verifyErrorFreeLog();
    assertTrue( "Test runner not generated", outputFile.exists() );
    assertEquals( lastUpdate, outputFile.lastModified() );
    verifier.resetStreams();
}
 
开发者ID:andi12,项目名称:msbuild-maven-plugin,代码行数:23,代码来源:MavenITCxxTestMojoTest.java

示例8: testSolutionClean

import org.apache.maven.it.util.ResourceExtractor; //导入依赖的package包/类
@Test
public void testSolutionClean() throws Exception
{
    File testDir = ResourceExtractor.simpleExtractResources( getClass(),
            "/hello-world-build-test" );
    File releaseDir = new File( testDir, "Release" );
    File debugDir = new File( testDir, "Debug" );

    Verifier verifier = new Verifier( testDir.getAbsolutePath() );
    addPropertiesToVerifier( verifier );
    
    verifier.executeGoal( "clean" );
    verifier.verifyErrorFreeLog();
    if ( releaseDir.exists() )
    {
        assertEquals( 0, releaseDir.list().length );
    }
    if ( debugDir.exists() )
    {
        assertEquals( 0, debugDir.list().length );
    }
}
 
开发者ID:andi12,项目名称:msbuild-maven-plugin,代码行数:23,代码来源:MavenITHelloWorldBuildTest.java

示例9: testProjectClean

import org.apache.maven.it.util.ResourceExtractor; //导入依赖的package包/类
@Test
public void testProjectClean() throws Exception
{
    File testDir = ResourceExtractor.simpleExtractResources( getClass(),
            "/hello-world-build-test/hello-world" );
    File releaseDir = new File( testDir, "Release" );
    File debugDir = new File( testDir, "Debug" );

    Verifier verifier = new Verifier( testDir.getAbsolutePath() );
    addPropertiesToVerifier( verifier );
    
    verifier.executeGoal( "clean" );
    verifier.verifyErrorFreeLog();
    checkProjectBuildOutputIsCleaned( "hello-world", releaseDir );
    checkProjectBuildOutputIsCleaned( "hello-world", debugDir );
}
 
开发者ID:andi12,项目名称:msbuild-maven-plugin,代码行数:17,代码来源:MavenITHelloWorldBuildTest.java

示例10: envVarPathConfiguration

import org.apache.maven.it.util.ResourceExtractor; //导入依赖的package包/类
@Test
public void envVarPathConfiguration() throws Exception
{
    final File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/hello-world-cppcheck-test" );

    Verifier verifier = new Verifier( testDir.getAbsolutePath() );
    addPropertiesToVerifier( verifier );
    // As we can't know a real location put a fake one and check the error message
    verifier.setEnvironmentVariable( "CPPCHECK_PATH", "my_fake_path" );

    try
    {
        verifier.executeGoal( GROUPID + ":" + ARTIFACTID + ":" + CppCheckMojo.MOJO_NAME );
        fail();
    }
    catch ( VerificationException ve )
    {
        verifier.verifyTextInLog( "my_fake_path" );
    }
}
 
开发者ID:andi12,项目名称:msbuild-maven-plugin,代码行数:21,代码来源:MavenITHelloWorldCppCheckTest.java

示例11: solutionCheck

import org.apache.maven.it.util.ResourceExtractor; //导入依赖的package包/类
@Test
public void solutionCheck() throws Exception
{
    File testDir = ResourceExtractor.simpleExtractResources( getClass(),
            "/hello-world-cppcheck-test" );

    Verifier verifier = new Verifier( testDir.getAbsolutePath() );
    addPropertiesToVerifier( verifier );
    verifier.getSystemProperties().setProperty( MSBuildMojoITHelper.MSBUILD_PLUGIN_TOOLS_ENABLE, "true" );
    
    verifier.executeGoal( GROUPID + ":" + ARTIFACTID + ":" + CppCheckMojo.MOJO_NAME );
    verifier.verifyErrorFreeLog();
    
    FileAssert.assertEquals( 
            new File( testDir, "expected\\cppcheck-report-hello-world-Win32-Debug.xml" ), 
            new File( testDir, "hello-world\\cppcheck-reports\\cppcheck-report-hello-world-Win32-Debug.xml" ) );

    FileAssert.assertEquals( 
            new File( testDir, "expected\\cppcheck-report-hello-world-Win32-Release.xml" ), 
            new File( testDir, "hello-world\\cppcheck-reports\\cppcheck-report-hello-world-Win32-Release.xml" ) );
}
 
开发者ID:andi12,项目名称:msbuild-maven-plugin,代码行数:22,代码来源:MavenITHelloWorldCppCheckTest.java

示例12: projectCheck

import org.apache.maven.it.util.ResourceExtractor; //导入依赖的package包/类
@Test
public void projectCheck() throws Exception
{
    File testDir = ResourceExtractor.simpleExtractResources( getClass(),
            "/hello-world-cppcheck-test/hello-world" );

    Verifier verifier = new Verifier( testDir.getAbsolutePath() );
    addPropertiesToVerifier( verifier );
    verifier.getSystemProperties().setProperty( MSBuildMojoITHelper.MSBUILD_PLUGIN_TOOLS_ENABLE, "true" );
    
    verifier.executeGoal( GROUPID + ":" + ARTIFACTID + ":" + CppCheckMojo.MOJO_NAME );
    verifier.verifyErrorFreeLog();
    
    FileAssert.assertEquals( 
            new File( testDir, "expected\\cppcheck-report-hello-world-Win32-Debug.xml" ), 
            new File( testDir, "cppcheck-reports\\cppcheck-report-hello-world-Win32-Debug.xml" ) );

    FileAssert.assertEquals( 
            new File( testDir, "expected\\cppcheck-report-hello-world-Win32-Release.xml" ), 
            new File( testDir, "cppcheck-reports\\cppcheck-report-hello-world-Win32-Release.xml" ) );
}
 
开发者ID:andi12,项目名称:msbuild-maven-plugin,代码行数:22,代码来源:MavenITHelloWorldCppCheckTest.java

示例13: simpleConfig

import org.apache.maven.it.util.ResourceExtractor; //导入依赖的package包/类
/**
 * Test simple configuration with no CppCheck or CxxTest
 * @throws Exception if there is a problem setting up and running Maven
 */
@Test
public void simpleConfig() throws Exception
{
    File testDir = ResourceExtractor.simpleExtractResources( getClass(),
            "/sonar-config-test" );

    Verifier verifier = new Verifier( testDir.getAbsolutePath() );
    addPropertiesToVerifier( verifier );
    
    verifier.executeGoal( SONAR_GOAL );
    verifier.verifyErrorFreeLog();

    FileAssert.assertEquals( 
            new File( testDir, "expected\\sonar-simple-Win32-Debug.properties" ), 
            new File( testDir, "target\\sonar-configuration-Win32-Debug.properties" ) );
    FileAssert.assertEquals( 
            new File( testDir, "expected\\sonar-simple-Win32-Release.properties" ), 
            new File( testDir, "target\\sonar-configuration-Win32-Release.properties" ) );
}
 
开发者ID:andi12,项目名称:msbuild-maven-plugin,代码行数:24,代码来源:MavenITSonarConfigurationTest.java

示例14: simpleConfigWithCppCheckCxxTest

import org.apache.maven.it.util.ResourceExtractor; //导入依赖的package包/类
/**
 * Test config generation when CppCheck and CxxTest are availabe
 * @throws Exception if there is a problem setting up and running Maven
 */
@Test
public void simpleConfigWithCppCheckCxxTest() throws Exception
{
    File testDir = ResourceExtractor.simpleExtractResources( getClass(),
            "/sonar-config-test" );

    Verifier verifier = new Verifier( testDir.getAbsolutePath() );
    addPropertiesToVerifier( verifier );
    verifier.getSystemProperties().setProperty( MSBuildMojoITHelper.MSBUILD_PLUGIN_TOOLS_ENABLE, "true" );
    
    verifier.executeGoal( SONAR_GOAL );
    verifier.verifyErrorFreeLog();

    FileAssert.assertEquals( 
            new File( testDir, "expected\\sonar-simpleplus-Win32-Debug.properties" ), 
            new File( testDir, "target\\sonar-configuration-Win32-Debug.properties" ) );
    FileAssert.assertEquals( 
            new File( testDir, "expected\\sonar-simpleplus-Win32-Release.properties" ), 
            new File( testDir, "target\\sonar-configuration-Win32-Release.properties" ) );
}
 
开发者ID:andi12,项目名称:msbuild-maven-plugin,代码行数:25,代码来源:MavenITSonarConfigurationTest.java

示例15: excludes

import org.apache.maven.it.util.ResourceExtractor; //导入依赖的package包/类
/**
 * Test excludeProjectRegex setting 
 * @throws Exception if there is a problem setting up and running Maven
 */
@Test
public void excludes() throws Exception
{
    File testDir = ResourceExtractor.simpleExtractResources( getClass(),
            "/sonar-config-test" );

    Verifier verifier = new Verifier( testDir.getAbsolutePath() );
    addPropertiesToVerifier( verifier );
    verifier.addCliOption( "-f excludes-pom.xml" );
    
    verifier.executeGoal( SONAR_GOAL );
    verifier.verifyErrorFreeLog();

    FileAssert.assertEquals( 
            new File( testDir, "expected\\sonar-excludes-Win32-Debug.properties" ), 
            new File( testDir, "target\\sonar-configuration-Win32-Debug.properties" ) );
    FileAssert.assertEquals( 
            new File( testDir, "expected\\sonar-excludes-Win32-Release.properties" ), 
            new File( testDir, "target\\sonar-configuration-Win32-Release.properties" ) );
}
 
开发者ID:andi12,项目名称:msbuild-maven-plugin,代码行数:25,代码来源:MavenITSonarConfigurationTest.java


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