Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BACKLOG-39710] Fix PentahoPlatformExporterTest #5514

Merged
merged 1 commit into from
Feb 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.ArgumentMatchers;
Expand All @@ -34,11 +33,7 @@
import org.pentaho.platform.api.mt.ITenant;
import org.pentaho.platform.api.repository.datasource.IDatasourceMgmtService;
import org.pentaho.platform.api.repository2.unified.IUnifiedRepository;
import org.pentaho.platform.api.scheduler2.IComplexJobTrigger;
import org.pentaho.platform.api.scheduler2.IScheduler;
import org.pentaho.platform.api.scheduler2.IJob;
import org.pentaho.platform.api.scheduler2.IJobTrigger;
import org.pentaho.platform.api.scheduler2.SchedulerException;
import org.pentaho.platform.api.usersettings.IAnyUserSettingService;
import org.pentaho.platform.api.usersettings.pojo.IUserSetting;
import org.pentaho.platform.engine.core.system.PentahoSessionHolder;
Expand Down Expand Up @@ -80,10 +75,8 @@
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.any;
import static org.mockito.ArgumentMatchers.nullable;
import static org.mockito.Mockito.when;
import static org.mockito.Mockito.anyBoolean;

public class PentahoPlatformExporterTest {

Expand Down Expand Up @@ -119,42 +112,6 @@ public void tearDown() {
PentahoSystem.clearObjectFactory();
}

@Test
@Ignore
public void testExportSchedules() throws Exception {
List<IJob> jobs = new ArrayList<>();
IComplexJobTrigger trigger = mock( IComplexJobTrigger.class );
IJobTrigger unknownTrigger = mock( IJobTrigger.class );

IJob job1 = mock( IJob.class );
IJob job2 = mock( IJob.class );
IJob job3 = mock( IJob.class );
jobs.add( job1 );
jobs.add( job2 );
jobs.add( job3 );

when( scheduler.getJobs( null ) ).thenReturn( jobs );
when( job1.getJobName() ).thenReturn( "job 1" );
when( job2.getJobName() ).thenReturn( "job 2" );
when( job2.getJobTrigger() ).thenReturn( trigger );
when( job3.getJobName() ).thenReturn( "job 3" );
when( job3.getJobTrigger() ).thenReturn( unknownTrigger );
// exporterSpy.exportSchedules();

verify( scheduler ).getJobs( null );
assertEquals( 1, exporterSpy.getExportManifest().getScheduleList().size() );
}

@Test
public void testExportSchedules_SchedulereThrowsException() throws Exception {
when( scheduler.getJobs( null ) ).thenThrow( new SchedulerException( "bad" ) );

// exporterSpy.exportSchedules();

verify( scheduler ).getJobs( null );
assertEquals( 0, exporterSpy.getExportManifest().getScheduleList().size() );
}

@Test
public void testExportUsersAndRoles() {
IUserRoleListService mockDao = mock( IUserRoleListService.class );
Expand Down Expand Up @@ -401,4 +358,4 @@ public void testIsExportCandidate() throws Exception {
assertFalse( exporter.isExportCandidate( "/etc/models" ) );
assertFalse( exporter.isExportCandidate( "/etc/pdi" ) );
}
}
}
Loading