diff options
author | Alexander Kurtakov | 2012-05-01 15:22:32 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2012-05-01 15:22:32 +0000 |
commit | a4f2cf45df40f9c33883d078e5067dc14d71b5d2 (patch) | |
tree | dba85da64654cb1a8b26b4626c538693a6a554fd /rpm | |
parent | 2dc9e01b8c7ed161fc9e4b86d16bd357f90bbd20 (diff) | |
download | org.eclipse.linuxtools-a4f2cf45df40f9c33883d078e5067dc14d71b5d2.tar.gz org.eclipse.linuxtools-a4f2cf45df40f9c33883d078e5067dc14d71b5d2.tar.xz org.eclipse.linuxtools-a4f2cf45df40f9c33883d078e5067dc14d71b5d2.zip |
Add few more test cases.
Diffstat (limited to 'rpm')
-rw-r--r-- | rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/tests/RPMProjectTest.java | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/tests/RPMProjectTest.java b/rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/tests/RPMProjectTest.java index 4fbeed388d..3aa0543342 100644 --- a/rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/tests/RPMProjectTest.java +++ b/rpm/org.eclipse.linuxtools.rpm.core.tests/src/org/eclipse/linuxtools/rpm/core/tests/RPMProjectTest.java @@ -30,6 +30,7 @@ import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.FileLocator; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Path; +import org.eclipse.linuxtools.rpm.core.IProjectConfiguration; import org.eclipse.linuxtools.rpm.core.IRPMConstants; import org.eclipse.linuxtools.rpm.core.RPMProject; import org.eclipse.linuxtools.rpm.core.RPMProjectLayout; @@ -109,6 +110,53 @@ public class RPMProjectTest { // Clean up testProject.delete(true, false, monitor); } + + @Test + public void testImportHelloWorldFlat() throws Exception { + // Create a project for the test + IProject testProject = root.getProject("testHelloWorld"); + testProject.create(monitor); + testProject.open(monitor); + + // Instantiate an RPMProject + RPMProject rpmProject = new RPMProject(testProject, + RPMProjectLayout.FLAT); + + // Find the test SRPM and install it + URL url = FileLocator.find(FrameworkUtil + .getBundle(RPMProjectTest.class), new Path( + "resources" + file_sep + "srpms" + file_sep + //$NON-NLS-1$ //$NON-NLS-2$ + "helloworld-2-2.src.rpm"), null); + if (url == null) { + fail("Unable to find resource" + file_sep + "srpms" + file_sep + + "helloworld-2-2.src.rpm"); + } + File foo = new File(FileLocator.toFileURL(url).getPath()); + rpmProject.importSourceRPM(foo); + + // Make sure the original SRPM got copied into the workspace + IFile srpm = rpmProject.getConfiguration().getSrpmsFolder() + .getFile(new Path("helloworld-2-2.src.rpm")); + assertTrue(srpm.exists()); + + // Make sure everything got installed properly + IFile spec = rpmProject.getConfiguration().getSpecsFolder() + .getFile(new Path("helloworld.spec")); + assertTrue(spec.exists()); + IFile sourceBall = rpmProject.getConfiguration().getSourcesFolder() + .getFile(new Path("helloworld-2.tar.bz2")); + assertTrue(sourceBall.exists()); + + // Make sure we got the spec file + IResource specFile = rpmProject.getSpecFile(); + assertNotNull(specFile); + + // Make sure the RPM nature was added + assertTrue(testProject.hasNature(IRPMConstants.RPM_NATURE_ID)); + + // Clean up + testProject.delete(true, false, monitor); + } @Test public void testBuildPrepHelloWorld() throws Exception { @@ -176,4 +224,29 @@ public class RPMProjectTest { testProject.delete(true, false, null); } + + @Test + public void testGetSourcesFolder() throws Exception { + + // Create a project for the test + IProject testProject = root.getProject("testBuildSourceRPMHelloWorld1"); + testProject.create(monitor); + testProject.open(monitor); + // Instantiate an RPMProject + RPMProject rpmProject = new RPMProject(testProject, + RPMProjectLayout.RPMBUILD); + IProjectConfiguration config = rpmProject.getConfiguration(); + String folder = config.getSourcesFolder().getLocation().toOSString(); + + boolean srcFolderPath = true; + + int sourceFolder = folder.indexOf("SOURCES"); + + if (sourceFolder==-1) { + srcFolderPath=false; + } + + assertTrue(srcFolderPath); + +} } |