Search in sources :

Example 6 with CreaterepoProject

use of org.eclipse.linuxtools.internal.rpm.createrepo.CreaterepoProject in project linuxtools by eclipse.

the class CreaterepoProjectTest method testGetRPMs.

/**
 * Test if getting the RPMs is successful.
 *
 * @throws CoreException
 * @throws IOException
 */
@Test
public void testGetRPMs() throws CoreException, IOException {
    CreaterepoProject createrepoProject = new CreaterepoProject(project);
    URL rpmURL = FileLocator.find(FrameworkUtil.getBundle(CreaterepoProjectTest.class), new Path(TEST_RPM_LOC1), null);
    File rpmFile = new File(FileLocator.toFileURL(rpmURL).getPath());
    createrepoProject.importRPM(rpmFile);
    rpmURL = FileLocator.find(FrameworkUtil.getBundle(CreaterepoProjectTest.class), new Path(TEST_RPM_LOC2), null);
    rpmFile = new File(FileLocator.toFileURL(rpmURL).getPath());
    createrepoProject.importRPM(rpmFile);
    List<IResource> rpms = createrepoProject.getRPMs();
    assertEquals(2, rpms.size());
}
Also used : Path(org.eclipse.core.runtime.Path) CreaterepoProject(org.eclipse.linuxtools.internal.rpm.createrepo.CreaterepoProject) IFile(org.eclipse.core.resources.IFile) File(java.io.File) URL(java.net.URL) IResource(org.eclipse.core.resources.IResource) Test(org.junit.Test)

Example 7 with CreaterepoProject

use of org.eclipse.linuxtools.internal.rpm.createrepo.CreaterepoProject in project linuxtools by eclipse.

the class CreaterepoProjectTest method testInitializeNoRepoFileSpecfied.

/**
 * Test if initializing createrepo project is successful
 * without specifying .repo file.
 *
 * @throws CoreException
 */
@Test
public void testInitializeNoRepoFileSpecfied() throws CoreException {
    // repo file will be found rather than initialized
    CreaterepoProject createrepoProject = new CreaterepoProject(project);
    // content folder is defined, but not created (wizard does that)
    assertNotNull(createrepoProject.getContentFolder());
    assertFalse(createrepoProject.getContentFolder().exists());
    // repo file is found and exists
    assertNotNull(createrepoProject.getRepoFile());
    assertTrue(createrepoProject.getRepoFile().exists());
    assertEquals(ICreaterepoTestConstants.REPO_NAME, createrepoProject.getRepoFile().getName());
}
Also used : CreaterepoProject(org.eclipse.linuxtools.internal.rpm.createrepo.CreaterepoProject) Test(org.junit.Test)

Aggregations

CreaterepoProject (org.eclipse.linuxtools.internal.rpm.createrepo.CreaterepoProject)7 Test (org.junit.Test)5 IFile (org.eclipse.core.resources.IFile)3 File (java.io.File)2 URL (java.net.URL)2 IResource (org.eclipse.core.resources.IResource)2 CoreException (org.eclipse.core.runtime.CoreException)2 Path (org.eclipse.core.runtime.Path)2 IFolder (org.eclipse.core.resources.IFolder)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 IStatus (org.eclipse.core.runtime.IStatus)1 Job (org.eclipse.core.runtime.jobs.Job)1 CreaterepoResourceChangeListener (org.eclipse.linuxtools.internal.rpm.createrepo.listener.CreaterepoResourceChangeListener)1 IEditorInput (org.eclipse.ui.IEditorInput)1 IWorkbench (org.eclipse.ui.IWorkbench)1 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)1 MessageConsoleStream (org.eclipse.ui.console.MessageConsoleStream)1 Ignore (org.junit.Ignore)1