Search in sources :

Example 1 with FBServiceManager

use of org.firebirdsql.management.FBServiceManager in project jaybird by FirebirdSQL.

the class TestV13Authentication method authenticateServiceUsingLegacyAuth.

/**
 * This test assumes that the Firebird 3 config for {@code UserManager} contains {@code Legacy_UserManager}.
 * <p>
 * Replicates the test of {@link org.firebirdsql.management.TestFBServiceManager#testGetServerVersion()}.
 * </p>
 */
@Test
public void authenticateServiceUsingLegacyAuth() throws Exception {
    final String username = "legacyauth";
    final String password = "legacy";
    databaseUserRule.createUser(username, password, "Legacy_UserManager");
    final FBServiceManager fbServiceManager = new FBServiceManager(FBTestProperties.getGdsType());
    fbServiceManager.setHost(FBTestProperties.DB_SERVER_URL);
    fbServiceManager.setPort(FBTestProperties.DB_SERVER_PORT);
    fbServiceManager.setUser(username);
    fbServiceManager.setPassword(password);
    final GDSServerVersion serverVersion = fbServiceManager.getServerVersion();
    assertThat(serverVersion, allOf(notNullValue(), not(equalTo(GDSServerVersion.INVALID_VERSION))));
}
Also used : GDSServerVersion(org.firebirdsql.gds.impl.GDSServerVersion) FBServiceManager(org.firebirdsql.management.FBServiceManager) Test(org.junit.Test)

Example 2 with FBServiceManager

use of org.firebirdsql.management.FBServiceManager in project jaybird by FirebirdSQL.

the class FBTestProperties method getDefaultSupportInfo.

/**
 * The {@link org.firebirdsql.util.FirebirdSupportInfo} for the default test server.
 *
 * @return Support info object
 */
public static FirebirdSupportInfo getDefaultSupportInfo() {
    try {
        if (firebirdSupportInfo == null) {
            final GDSType gdsType = getGdsType();
            final FBServiceManager fbServiceManager = new FBServiceManager(gdsType);
            if (gdsType == GDSType.getType("PURE_JAVA") || gdsType == GDSType.getType("NATIVE") || gdsType == GDSType.getType("OOREMOTE")) {
                fbServiceManager.setServerName(DB_SERVER_URL);
                fbServiceManager.setPortNumber(DB_SERVER_PORT);
            }
            fbServiceManager.setUser(FBTestProperties.DB_USER);
            fbServiceManager.setPassword(FBTestProperties.DB_PASSWORD);
            firebirdSupportInfo = FirebirdSupportInfo.supportInfoFor(fbServiceManager.getServerVersion());
        }
        return firebirdSupportInfo;
    } catch (Exception e) {
        throw new IllegalStateException("Cannot initialize support info", e);
    }
}
Also used : FBServiceManager(org.firebirdsql.management.FBServiceManager) GDSType(org.firebirdsql.gds.impl.GDSType) SQLException(java.sql.SQLException)

Example 3 with FBServiceManager

use of org.firebirdsql.management.FBServiceManager in project jaybird by FirebirdSQL.

the class TestV13Authentication method authenticateServiceUsingSrpAuth.

/**
 * This test assumes that the Firebird 3 config for {@code UserManager} contains {@code Srp}.
 * <p>
 * Replicates the test of {@link org.firebirdsql.management.TestFBServiceManager#testGetServerVersion()}.
 * </p>
 */
@Test
public void authenticateServiceUsingSrpAuth() throws Exception {
    final String username = "srpauth";
    final String password = "srp";
    databaseUserRule.createUser(username, password, "Srp");
    final FBServiceManager fbServiceManager = new FBServiceManager(FBTestProperties.getGdsType());
    fbServiceManager.setHost(FBTestProperties.DB_SERVER_URL);
    fbServiceManager.setPort(FBTestProperties.DB_SERVER_PORT);
    fbServiceManager.setUser(username);
    fbServiceManager.setPassword(password);
    final GDSServerVersion serverVersion = fbServiceManager.getServerVersion();
    assertThat(serverVersion, allOf(notNullValue(), not(equalTo(GDSServerVersion.INVALID_VERSION))));
}
Also used : GDSServerVersion(org.firebirdsql.gds.impl.GDSServerVersion) FBServiceManager(org.firebirdsql.management.FBServiceManager) Test(org.junit.Test)

Example 4 with FBServiceManager

use of org.firebirdsql.management.FBServiceManager in project jaybird by FirebirdSQL.

the class Firebird3PlusAuthenticationTest method authenticateServiceUsingLegacyAuth.

/**
 * This test assumes that the Firebird 3 config for {@code UserManager} contains {@code Legacy_UserManager}.
 * <p>
 * Replicates the test of {@code FBServiceManagerTest.testGetServerVersion()}.
 * </p>
 */
@Test
public void authenticateServiceUsingLegacyAuth() throws Exception {
    final String username = "legacyauth";
    final String password = "legacy";
    databaseUserRule.createUser(username, password, "Legacy_UserManager");
    final FBServiceManager fbServiceManager = new FBServiceManager(FBTestProperties.getGdsType());
    fbServiceManager.setServerName(FBTestProperties.DB_SERVER_URL);
    fbServiceManager.setPortNumber(FBTestProperties.DB_SERVER_PORT);
    fbServiceManager.setUser(username);
    fbServiceManager.setPassword(password);
    fbServiceManager.setAuthPlugins("Legacy_Auth");
    final GDSServerVersion serverVersion = fbServiceManager.getServerVersion();
    assertThat(serverVersion, allOf(notNullValue(), not(equalTo(GDSServerVersion.INVALID_VERSION))));
}
Also used : GDSServerVersion(org.firebirdsql.gds.impl.GDSServerVersion) FBServiceManager(org.firebirdsql.management.FBServiceManager) Test(org.junit.Test)

Example 5 with FBServiceManager

use of org.firebirdsql.management.FBServiceManager in project jaybird by FirebirdSQL.

the class Firebird3PlusAuthenticationTest method authenticateServiceUsingSrpAuth.

/**
 * This test assumes that the Firebird 3 config for {@code UserManager} contains {@code Srp}.
 * <p>
 * Replicates the test of {@code FBServiceManagerTest.testGetServerVersion()}.
 * </p>
 */
@Test
public void authenticateServiceUsingSrpAuth() throws Exception {
    final String username = "srpauth";
    final String password = "srp";
    databaseUserRule.createUser(username, password, "Srp");
    final FBServiceManager fbServiceManager = new FBServiceManager(FBTestProperties.getGdsType());
    fbServiceManager.setServerName(FBTestProperties.DB_SERVER_URL);
    fbServiceManager.setPortNumber(FBTestProperties.DB_SERVER_PORT);
    fbServiceManager.setUser(username);
    fbServiceManager.setPassword(password);
    final GDSServerVersion serverVersion = fbServiceManager.getServerVersion();
    assertThat(serverVersion, allOf(notNullValue(), not(equalTo(GDSServerVersion.INVALID_VERSION))));
}
Also used : GDSServerVersion(org.firebirdsql.gds.impl.GDSServerVersion) FBServiceManager(org.firebirdsql.management.FBServiceManager) Test(org.junit.Test)

Aggregations

FBServiceManager (org.firebirdsql.management.FBServiceManager)5 GDSServerVersion (org.firebirdsql.gds.impl.GDSServerVersion)4 Test (org.junit.Test)4 SQLException (java.sql.SQLException)1 GDSType (org.firebirdsql.gds.impl.GDSType)1