本文整理了Java中org.pentaho.di.repository.Repository.isConnected
方法的一些代码示例,展示了Repository.isConnected
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Repository.isConnected
方法的具体详情如下:
包路径:org.pentaho.di.repository.Repository
类名称:Repository
方法名:isConnected
暂无
代码示例来源:origin: pentaho/pentaho-kettle
@Override
public boolean isConnected() {
return getDelegate().isConnected();
}
代码示例来源:origin: pentaho/pentaho-kettle
/**
* Resets the repository so that next time {@link #getRepository()} is called a new repository is returned.
* This is called whenever the user or password is changed for this instance of the repository
*/
public void reconnectToRepository() {
if ( this.repository == null ) {
return;
}
if ( this.repository.isConnected() ) {
this.repository.disconnect();
}
try {
this.repository.connect( this.getUsername(), this.getPassword() );
this.shouldReconnect = false;
} catch ( KettleException e ) {
logger.debug( "Unable to connect to repository \"{}\".", this.repository.getRepositoryMeta().getId() );
}
}
}
代码示例来源:origin: pentaho/pentaho-kettle
@Before
public void setUp() throws Exception {
doReturn( true ).when( repository ).isConnected();
doReturn( null ).when( repository ).getJobEntryAttributeString( any( ObjectId.class ), anyString() );
doReturn( rdi ).when( repository ).loadRepositoryDirectoryTree();
doReturn( directory ).when( rdi ).findDirectory( JOB_ENTRY_FILE_DIRECTORY );
doReturn( directory ).when( rdi ).findDirectory( "/home/admin/folder" );
doReturn( null ).when( space ).environmentSubstitute( anyString() );
doReturn( "" ).when( space ).environmentSubstitute( "" );
doReturn( JOB_ENTRY_FILE_PATH ).when( space ).environmentSubstitute( JOB_ENTRY_FILE_PATH );
doReturn( JOB_ENTRY_FILE_NAME ).when( space ).environmentSubstitute( JOB_ENTRY_FILE_NAME );
doReturn( JOB_ENTRY_FILE_DIRECTORY ).when( space ).environmentSubstitute( JOB_ENTRY_FILE_DIRECTORY );
doReturn( "hdfs://server/path/" ).when( space ).environmentSubstitute( "${hdfs}" );
doReturn( "/home/admin/folder/job.kjb" ).when( space ).environmentSubstitute( "${repositoryfullfilepath}" );
doReturn( "/home/admin/folder/" ).when( space ).environmentSubstitute( "${repositorypath}" );
doReturn( "job.kjb" ).when( space ).environmentSubstitute( "${jobname}" );
doReturn( "job" ).when( space ).environmentSubstitute( "job" );
doCallRealMethod().when( resolver ).normalizeSlashes( anyString() );
doReturn( space ).when( resolver ).resolveCurrentDirectory(
any( ObjectLocationSpecificationMethod.class ), any( VariableSpace.class ), any( Repository.class ), any( Job.class ), anyString() );
whenNew( CurrentDirectoryResolver.class ).withNoArguments().thenReturn( resolver );
whenNew( JobMeta.class ).withAnyArguments().thenReturn( mock( JobMeta.class ) );
}
代码示例来源:origin: pentaho/pentaho-kettle
/**
* When connected to the repository and {@link JobEntryJob} references a child job by {@link ObjectId},
* keep {@link ObjectLocationSpecificationMethod} as {@code REPOSITORY_BY_REFERENCE}.
* Load the job from the repository using the specified {@link ObjectId}.
*/
@Test
public void testConnectedLoad_RepByRef() throws Exception {
Repository myrepo = mock( Repository.class );
doReturn( true ).when( myrepo ).isConnected();
doReturn( null ).when( myrepo ).getJobEntryAttributeString( any( ObjectId.class ), anyString() );
doReturn( "rep_ref" ).when( myrepo ).getJobEntryAttributeString( JOB_ENTRY_JOB_OBJECT_ID, "specification_method" );
doReturn( JOB_ENTRY_JOB_OBJECT_ID.toString() ).when( myrepo ).getJobEntryAttributeString( JOB_ENTRY_JOB_OBJECT_ID, "job_object_id" );
JobEntryJob jej = spy( new JobEntryJob( JOB_ENTRY_JOB_NAME ) );
jej.loadRep( myrepo, store, JOB_ENTRY_JOB_OBJECT_ID, databases, servers );
jej.getJobMeta( myrepo, store, space );
assertEquals( ObjectLocationSpecificationMethod.REPOSITORY_BY_REFERENCE, jej.getSpecificationMethod() );
verify( myrepo, times( 1 ) ).loadJob( JOB_ENTRY_JOB_OBJECT_ID, null );
}
代码示例来源:origin: pentaho/pentaho-kettle
/**
* When connected to the repository and {@link JobEntryJob} references a child job by name,
* guess {@link ObjectLocationSpecificationMethod} as {@code REPOSITORY_BY_NAME}.
* Load the job from the repository using the specified job name and directory.
*/
@Test
public void testConnectedLoad_RepByName_Guess() throws Exception {
Repository myrepo = mock( Repository.class );
doReturn( true ).when( myrepo ).isConnected();
doReturn( rdi ).when( myrepo ).loadRepositoryDirectoryTree();
doReturn( null ).when( myrepo ).getJobEntryAttributeString( any( ObjectId.class ), anyString() );
doReturn( JOB_ENTRY_FILE_NAME ).when( myrepo ).getJobEntryAttributeString( JOB_ENTRY_JOB_OBJECT_ID, "name" );
doReturn( JOB_ENTRY_FILE_DIRECTORY ).when( myrepo ).getJobEntryAttributeString( JOB_ENTRY_JOB_OBJECT_ID, "dir_path" );
JobEntryJob jej = spy( new JobEntryJob( JOB_ENTRY_JOB_NAME ) );
jej.loadRep( myrepo, store, JOB_ENTRY_JOB_OBJECT_ID, databases, servers );
jej.getJobMeta( myrepo, store, space );
assertEquals( ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME, jej.getSpecificationMethod() );
verify( myrepo, times( 1 ) ).loadJob( JOB_ENTRY_FILE_NAME, directory, null, null );
}
代码示例来源:origin: pentaho/pentaho-kettle
/**
* When connected to the repository and {@link JobEntryJob} references a child job by name using a single parameter,
* keep {@link ObjectLocationSpecificationMethod} as {@code REPOSITORY_BY_NAME}.
* Load the job from the repository using the specified job name and directory.
*/
@Test
public void testConnectedLoad_RepByName_SingleParameter() throws Exception {
Repository myrepo = mock( Repository.class );
doReturn( true ).when( myrepo ).isConnected();
doReturn( rdi ).when( myrepo ).loadRepositoryDirectoryTree();
doReturn( null ).when( myrepo ).getJobEntryAttributeString( any( ObjectId.class ), anyString() );
doReturn( "rep_name" ).when( myrepo ).getJobEntryAttributeString( JOB_ENTRY_JOB_OBJECT_ID, "specification_method" );
doReturn( "${repositoryfullfilepath}" ).when( myrepo ).getJobEntryAttributeString( JOB_ENTRY_JOB_OBJECT_ID, "name" );
JobEntryJob jej = spy( new JobEntryJob( JOB_ENTRY_JOB_NAME ) );
jej.loadRep( myrepo, store, JOB_ENTRY_JOB_OBJECT_ID, databases, servers );
jej.getJobMeta( myrepo, store, space );
assertEquals( ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME, jej.getSpecificationMethod() );
verify( myrepo, times( 1 ) ).loadJob( "job.kjb", directory, null, null );
}
代码示例来源:origin: pentaho/pentaho-kettle
/**
* When connected to the repository and {@link JobEntryJob} references a child job by {@link ObjectId},
* guess {@link ObjectLocationSpecificationMethod} as {@code REPOSITORY_BY_REFERENCE}.
* Load the job from the repository using the specified {@link ObjectId}.
*/
@Test
public void testConnectedLoad_RepByRef_Guess() throws Exception {
Repository myrepo = mock( Repository.class );
doReturn( true ).when( myrepo ).isConnected();
doReturn( null ).when( myrepo ).getJobEntryAttributeString( any( ObjectId.class ), anyString() );
doReturn( JOB_ENTRY_JOB_OBJECT_ID.toString() ).when( myrepo ).getJobEntryAttributeString( JOB_ENTRY_JOB_OBJECT_ID, "job_object_id" );
JobEntryJob jej = spy( new JobEntryJob( JOB_ENTRY_JOB_NAME ) );
jej.loadRep( myrepo, store, JOB_ENTRY_JOB_OBJECT_ID, databases, servers );
jej.getJobMeta( myrepo, store, space );
assertEquals( ObjectLocationSpecificationMethod.REPOSITORY_BY_REFERENCE, jej.getSpecificationMethod() );
verify( myrepo, times( 1 ) ).loadJob( JOB_ENTRY_JOB_OBJECT_ID, null );
}
代码示例来源:origin: pentaho/pentaho-kettle
/**
* When connected to the repository and {@link JobEntryJob} references a child job by name,
* keep {@link ObjectLocationSpecificationMethod} as {@code REPOSITORY_BY_NAME}.
* Load the job from the repository using the specified job name and directory.
*/
@Test
public void testConnectedLoad_RepByName() throws Exception {
Repository myrepo = mock( Repository.class );
doReturn( true ).when( myrepo ).isConnected();
doReturn( rdi ).when( myrepo ).loadRepositoryDirectoryTree();
doReturn( null ).when( myrepo ).getJobEntryAttributeString( any( ObjectId.class ), anyString() );
doReturn( "rep_name" ).when( myrepo ).getJobEntryAttributeString( JOB_ENTRY_JOB_OBJECT_ID, "specification_method" );
doReturn( JOB_ENTRY_FILE_NAME ).when( myrepo ).getJobEntryAttributeString( JOB_ENTRY_JOB_OBJECT_ID, "name" );
doReturn( JOB_ENTRY_FILE_DIRECTORY ).when( myrepo ).getJobEntryAttributeString( JOB_ENTRY_JOB_OBJECT_ID, "dir_path" );
JobEntryJob jej = spy( new JobEntryJob( JOB_ENTRY_JOB_NAME ) );
jej.loadRep( myrepo, store, JOB_ENTRY_JOB_OBJECT_ID, databases, servers );
jej.getJobMeta( myrepo, store, space );
assertEquals( ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME, jej.getSpecificationMethod() );
verify( myrepo, times( 1 ) ).loadJob( JOB_ENTRY_FILE_NAME, directory, null, null );
}
代码示例来源:origin: pentaho/pentaho-kettle
/**
* When connected to the repository and {@link JobEntryJob} references a child job by name using multiple parameters,
* keep {@link ObjectLocationSpecificationMethod} as {@code REPOSITORY_BY_NAME}.
* Load the job from the repository using the specified job name and directory.
*/
@Test
public void testConnectedLoad_RepByName_MultipleParameters() throws Exception {
Repository myrepo = mock( Repository.class );
doReturn( true ).when( myrepo ).isConnected();
doReturn( rdi ).when( myrepo ).loadRepositoryDirectoryTree();
doReturn( null ).when( myrepo ).getJobEntryAttributeString( any( ObjectId.class ), anyString() );
doReturn( "rep_name" ).when( myrepo ).getJobEntryAttributeString( JOB_ENTRY_JOB_OBJECT_ID, "specification_method" );
doReturn( "${jobname}" ).when( myrepo ).getJobEntryAttributeString( JOB_ENTRY_JOB_OBJECT_ID, "name" );
doReturn( "${repositorypath}" ).when( myrepo ).getJobEntryAttributeString( JOB_ENTRY_JOB_OBJECT_ID, "dir_path" );
JobEntryJob jej = spy( new JobEntryJob( JOB_ENTRY_JOB_NAME ) );
jej.loadRep( myrepo, store, JOB_ENTRY_JOB_OBJECT_ID, databases, servers );
jej.getJobMeta( myrepo, store, space );
assertEquals( ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME, jej.getSpecificationMethod() );
verify( myrepo, times( 1 ) ).loadJob( "job.kjb", directory, null, null );
}
代码示例来源:origin: pentaho/pentaho-kettle
/**
* When connected to the repository and {@link JobEntryJob} references a child job by file path,
* guess {@link ObjectLocationSpecificationMethod} as {@code FILENAME}.
* Load the job from the repository using the specified file path.
*/
@Test
public void testConnectedLoad_Filename_Guess() throws Exception {
Repository myrepo = mock( Repository.class );
doReturn( true ).when( myrepo ).isConnected();
doReturn( null ).when( myrepo ).getJobEntryAttributeString( any( ObjectId.class ), anyString() );
doReturn( JOB_ENTRY_FILE_PATH ).when( myrepo ).getJobEntryAttributeString( JOB_ENTRY_JOB_OBJECT_ID, "file_name" );
JobEntryJob jej = spy( new JobEntryJob( JOB_ENTRY_JOB_NAME ) );
jej.loadRep( myrepo, store, JOB_ENTRY_JOB_OBJECT_ID, databases, servers );
jej.getJobMeta( myrepo, store, space );
assertEquals( ObjectLocationSpecificationMethod.FILENAME, jej.getSpecificationMethod() );
verifyNew( JobMeta.class ).withArguments( space, JOB_ENTRY_FILE_PATH, myrepo, store, null );
}
代码示例来源:origin: pentaho/pentaho-kettle
/**
* When connected to the repository and {@link JobEntryJob} references a child job by file path,
* keep {@link ObjectLocationSpecificationMethod} as {@code FILENAME}.
* Load the job from the repository using the specified file path.
*/
@Test
public void testConnectedLoad_Filename() throws Exception {
Repository myrepo = mock( Repository.class );
doReturn( true ).when( myrepo ).isConnected();
doReturn( null ).when( myrepo ).getJobEntryAttributeString( any( ObjectId.class ), anyString() );
doReturn( "filename" ).when( myrepo ).getJobEntryAttributeString( JOB_ENTRY_JOB_OBJECT_ID, "specification_method" );
doReturn( JOB_ENTRY_FILE_PATH ).when( myrepo ).getJobEntryAttributeString( JOB_ENTRY_JOB_OBJECT_ID, "file_name" );
JobEntryJob jej = spy( new JobEntryJob( JOB_ENTRY_JOB_NAME ) );
jej.loadRep( myrepo, store, JOB_ENTRY_JOB_OBJECT_ID, databases, servers );
jej.getJobMeta( myrepo, store, space );
assertEquals( ObjectLocationSpecificationMethod.FILENAME, jej.getSpecificationMethod() );
verifyNew( JobMeta.class ).withArguments( space, JOB_ENTRY_FILE_PATH, myrepo, store, null );
}
代码示例来源:origin: pentaho/pentaho-kettle
/**
* When connected to the repository and {@link JobEntryJob} references a child job by name,
* keep {@link ObjectLocationSpecificationMethod} as {@code REPOSITORY_BY_NAME}.
* Load the job from the repository using the specified job name and directory.
*/
@Test
public void testConnectedLoad_RepByName_HDFS() throws Exception {
Repository myrepo = mock( Repository.class );
doReturn( true ).when( myrepo ).isConnected();
doReturn( null ).when( myrepo ).getJobEntryAttributeString( any( ObjectId.class ), anyString() );
doReturn( "rep_name" ).when( myrepo ).getJobEntryAttributeString( JOB_ENTRY_JOB_OBJECT_ID, "specification_method" );
doReturn( "job" ).when( myrepo ).getJobEntryAttributeString( JOB_ENTRY_JOB_OBJECT_ID, "name" );
doReturn( "${hdfs}" ).when( myrepo ).getJobEntryAttributeString( JOB_ENTRY_JOB_OBJECT_ID, "dir_path" );
JobEntryJob jej = spy( new JobEntryJob( JOB_ENTRY_JOB_NAME ) );
jej.loadRep( myrepo, store, JOB_ENTRY_JOB_OBJECT_ID, databases, servers );
jej.getJobMeta( myrepo, store, space );
assertEquals( ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME, jej.getSpecificationMethod() );
verifyNew( JobMeta.class ).withArguments( space, "hdfs://server/path/job.kjb", myrepo, store, null );
}
代码示例来源:origin: pentaho/pentaho-kettle
if ( job.getRep() != null && !job.getRep().isConnected() ) {
if ( job.getRep().getUserInfo() != null ) {
job.getRep().connect(
代码示例来源:origin: pentaho/pentaho-kettle
directory = XMLHandler.getTagValue( entrynode, "directory" );
if ( rep != null && rep.isConnected() && !Utils.isEmpty( transname ) ) {
specificationMethod = ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME;
代码示例来源:origin: pentaho/pentaho-kettle
if ( job.getRep() != null && !job.getRep().isConnected() ) {
if ( job.getRep().getUserInfo() != null ) {
job.getRep().connect( job.getRep().getUserInfo().getLogin(), job.getRep().getUserInfo().getPassword() );
代码示例来源:origin: pentaho/pentaho-kettle
if ( rep != null && rep.isConnected() ) {
if ( !Utils.isEmpty( jobname ) ) {
specificationMethod = ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME;
代码示例来源:origin: pentaho/pentaho-kettle
} else {
log.logBasic( "No metastore found in the repository : "
+ rep.getName() + ", connected? " + rep.isConnected() );
代码示例来源:origin: pentaho/pentaho-kettle
throws KettleXMLException, ParserConfigurationException, SAXException, IOException {
Repository rep = mock( Repository.class );
when( rep.isConnected() ).thenReturn( true );
代码示例来源:origin: pentaho/pentaho-kettle
if ( repos.isConnected() ) {
try {
FileDialogOperation fileDialogOperation =
内容来源于网络,如有侵权,请联系作者删除!