org.eclipse.jgit.util.SystemReader Java Examples

The following examples show how to use org.eclipse.jgit.util.SystemReader. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TransportCommand.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public final void run () throws GitException {
    SystemReader original = SystemReader.getInstance();
    String externalTool = original.getenv(PROP_ENV_GIT_SSH);
    boolean replace = externalTool != null;
    if ("true".equals(System.getProperty(PROP_GIT_SSH_SYSTEM_CLIENT, "false"))) { // NOI18N
        replace = false;
    }
    try {
        if (replace) {
            LOG.log(Level.WARNING, "{0} set to {1}, ignoring and using the default implementation via JSch", new Object[] { PROP_ENV_GIT_SSH, externalTool }); //NOI18N
            SystemReader.setInstance(new DelegatingSystemReader(original));
        }
        runTransportCommand();
    } finally {
        if (replace) {
            SystemReader.setInstance(original);
        }
    }
}
 
Example #2
Source File: ConfigClientBackwardsCompatibilityIntegrationTests.java    From spring-cloud-config with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void init() throws IOException {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());

	ConfigServerTestUtils.prepareLocalRepo();
}
 
Example #3
Source File: NativeConfigServerIntegrationTests.java    From spring-cloud-config with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void init() throws IOException {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());

	ConfigServerTestUtils.prepareLocalRepo();
}
 
Example #4
Source File: BootstrapConfigServerIntegrationTests.java    From spring-cloud-config with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void init() throws IOException {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());

	ConfigServerTestUtils.prepareLocalRepo("encrypt-repo");
}
 
Example #5
Source File: UIGit.java    From hop with Apache License 2.0 5 votes vote down vote up
@Override
public boolean commit( String authorName, String message ) {
  PersonIdent author = RawParseUtils.parsePersonIdent( authorName );
  // Set the local time
  PersonIdent author2 = new PersonIdent( author.getName(), author.getEmailAddress(),
      SystemReader.getInstance().getCurrentTime(),
      SystemReader.getInstance().getTimezone( SystemReader.getInstance().getCurrentTime() ) );
  try {
    git.commit().setAuthor( author2 ).setMessage( message ).call();
    return true;
  } catch ( Exception e ) {
    showMessageBox( BaseMessages.getString( PKG, "Dialog.Error" ), e.getMessage() );
    return false;
  }
}
 
Example #6
Source File: ConfigClientOffIntegrationTests.java    From spring-cloud-config with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void init() throws IOException {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());

	ConfigServerTestUtils.prepareLocalRepo();
}
 
Example #7
Source File: CompositeIntegrationTests.java    From spring-cloud-config with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void init() throws Exception {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());

	ConfigServerTestUtils.prepareLocalRepo();
	ConfigServerTestUtils.prepareLocalSvnRepo(
			"src/test/resources/svn-config-repo", "target/repos/svn-config-repo");
}
 
Example #8
Source File: CompositeIntegrationTests.java    From spring-cloud-config with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void init() throws Exception {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());

	ConfigServerTestUtils.prepareLocalRepo();
	ConfigServerTestUtils.prepareLocalSvnRepo(
			"src/test/resources/svn-config-repo", "target/repos/svn-config-repo");
}
 
Example #9
Source File: VanillaConfigServerIntegrationTests.java    From spring-cloud-config with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void init() throws IOException {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());

	ConfigServerTestUtils.prepareLocalRepo();
}
 
Example #10
Source File: ConfigClientOnIntegrationTests.java    From spring-cloud-config with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void init() throws IOException {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());

	localRepo = ConfigServerTestUtils.prepareLocalRepo();
}
 
Example #11
Source File: RefreshableConfigServerIntegrationTests.java    From spring-cloud-config with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void init() throws IOException {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());

	localRepo = ConfigServerTestUtils.prepareLocalRepo();
}
 
Example #12
Source File: CustomCompositeEnvironmentRepositoryTests.java    From spring-cloud-config with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void init() throws Exception {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());

	ConfigServerTestUtils.prepareLocalRepo();
}
 
Example #13
Source File: CustomCompositeEnvironmentRepositoryTests.java    From spring-cloud-config with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void init() throws Exception {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());

	ConfigServerTestUtils.prepareLocalRepo();
}
 
Example #14
Source File: OpenGlobalConfigurationAction.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected void performContextAction (final Node[] nodes) {
    Utils.postParallel(new Runnable () {
        @Override
        public void run() {
            File config = SystemReader.getInstance().openUserConfig(null, FS.DETECTED).getFile();
            if (!config.exists()) {
                if (shallCreate(config)) {
                    try {
                        if (!config.createNewFile()) {
                            LOG.log(Level.WARNING, "Git config not created: {0}", new Object[] { config.getPath() });
                        }
                    } catch (IOException ex) {
                        GitClientExceptionHandler.notifyException(ex, true);
                    }
                } else {
                    return;
                }
            }
            if (config.canRead()) {
                Utils.openFile(config);
            } else {
                LOG.log(Level.WARNING, "Cannot read Git config: {0}", new Object[] { config.getPath() });
            }
        }

    }, 0);
}
 
Example #15
Source File: JGitEnvironmentRepositoryConcurrencyTests.java    From spring-cloud-config with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void initClass() {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());
}
 
Example #16
Source File: MultipleJGitEnvironmentRepositoryTests.java    From spring-cloud-config with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void initClass() {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());
}
 
Example #17
Source File: JGitEnvironmentRepositoryTests.java    From spring-cloud-config with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void initClass() {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());
}
 
Example #18
Source File: JGitEnvironmentRepositoryIntegrationTests.java    From spring-cloud-config with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void initClass() {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());
}
 
Example #19
Source File: MultipleJGitEnvironmentApplicationPlaceholderRepositoryTests.java    From spring-cloud-config with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void initClass() {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());
}
 
Example #20
Source File: MultipleJGitEnvironmentLabelPlaceholderRepositoryTests.java    From spring-cloud-config with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void initClass() {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());
}
 
Example #21
Source File: MultipleJGitEnvironmentRepositoryIntegrationTests.java    From spring-cloud-config with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void initClass() {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());
}
 
Example #22
Source File: MultipleJGitEnvironmentProfilePlaceholderRepositoryTests.java    From spring-cloud-config with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void initClass() {
	// mock Git configuration to make tests independent of local Git configuration
	SystemReader.setInstance(new MockSystemReader());
}
 
Example #23
Source File: ConnectionTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public DelegatingSystemReader (SystemReader sr) {
    this.instance = sr;
}
 
Example #24
Source File: TransportCommand.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public DelegatingSystemReader (SystemReader sr) {
    this.instance = sr;
}
 
Example #25
Source File: GitUtils.java    From onedev with MIT License 4 votes vote down vote up
public static PersonIdent newPersonIdent(String name, String email, Date when) {
	return new PersonIdent(name, email, when.getTime(), 
			SystemReader.getInstance().getTimezone(when.getTime()));
}