-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(#101) Created tests, added classes and configuration for external DB…
…MS related autotests.
- Loading branch information
Showing
24 changed files
with
920 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/main/java/org/fusionsoft/database/snapshot/objects/dbms/postgres/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Copyright (C) 2018-2021 FusionSoft | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* You may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
* either express or implied. | ||
* | ||
* See the License for the specific language governing permissions | ||
* and limitations under the License. | ||
*/ | ||
|
||
/** | ||
* Postgres DBMS's objects, constructed from different sources. | ||
*/ | ||
package org.fusionsoft.database.snapshot.objects.dbms.postgres; |
36 changes: 36 additions & 0 deletions
36
src/main/java/org/fusionsoft/lib/ci/credentials/Credentials.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright (C) 2018-2021 FusionSoft | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* You may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
* either express or implied. | ||
* | ||
* See the License for the specific language governing permissions | ||
* and limitations under the License. | ||
*/ | ||
package org.fusionsoft.lib.ci.credentials; | ||
|
||
/** | ||
* The interface representing any simple Credentials. | ||
* @since 0.1 | ||
*/ | ||
public interface Credentials { | ||
|
||
/** | ||
* Username string. | ||
* @return The string. | ||
*/ | ||
String username(); | ||
|
||
/** | ||
* Password string. | ||
* @return The string. | ||
*/ | ||
String password(); | ||
|
||
} |
57 changes: 57 additions & 0 deletions
57
src/main/java/org/fusionsoft/lib/ci/credentials/CredentialsFromFile.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright (C) 2018-2021 FusionSoft | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* You may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
* either express or implied. | ||
* | ||
* See the License for the specific language governing permissions | ||
* and limitations under the License. | ||
*/ | ||
package org.fusionsoft.lib.ci.credentials; | ||
|
||
import java.nio.file.Path; | ||
import java.util.List; | ||
import org.cactoos.Text; | ||
import org.cactoos.list.ListOf; | ||
import org.cactoos.text.Split; | ||
import org.cactoos.text.TextOf; | ||
|
||
/** | ||
* The type of {@link Credentials} that can be constructed of file. | ||
* @since 0.1 | ||
*/ | ||
public class CredentialsFromFile extends CredentialsOfScalar { | ||
|
||
/** | ||
* Instantiates a new Credentials from file. | ||
* @param lines The List of Text to be encapsulated. | ||
*/ | ||
private CredentialsFromFile(final List<Text> lines) { | ||
super(() -> new SimpleCredentials( | ||
lines.get(0).asString().trim(), | ||
lines.get(1).asString().trim() | ||
)); | ||
} | ||
|
||
/** | ||
* Instantiates a new Credentials from file. | ||
* @param path The Path to be encapsulated. | ||
*/ | ||
public CredentialsFromFile(final Path path) { | ||
this( | ||
new ListOf<Text>( | ||
new Split( | ||
new TextOf(path), | ||
"\n" | ||
) | ||
) | ||
); | ||
} | ||
|
||
} |
46 changes: 46 additions & 0 deletions
46
src/main/java/org/fusionsoft/lib/ci/credentials/CredentialsFromProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright (C) 2018-2021 FusionSoft | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* You may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
* either express or implied. | ||
* | ||
* See the License for the specific language governing permissions | ||
* and limitations under the License. | ||
*/ | ||
package org.fusionsoft.lib.ci.credentials; | ||
|
||
import org.cactoos.text.Joined; | ||
import org.fusionsoft.lib.exception.ValueNotFoundException; | ||
|
||
/** | ||
* The type of {@link Credentials} that can be constructed of. | ||
* @since 0.1 | ||
*/ | ||
public class CredentialsFromProperties extends CredentialsOfScalar { | ||
|
||
/** | ||
* Instantiates a new Credentials from properties. | ||
* @param propuser The properties key with username to be encapsulated. | ||
* @param proppassword The properties key with password to be encapsulated. | ||
*/ | ||
public CredentialsFromProperties(final String propuser, final String proppassword) { | ||
super(() -> { | ||
final String usr = System.getProperty(propuser); | ||
final String pwd = System.getProperty(proppassword); | ||
if (usr == null || usr.isEmpty() || pwd == null || pwd.isEmpty()) { | ||
throw new ValueNotFoundException( | ||
new Joined(",", propuser, proppassword).asString(), | ||
"System.props" | ||
); | ||
} | ||
return new SimpleCredentials(usr, pwd); | ||
}); | ||
} | ||
|
||
} |
55 changes: 55 additions & 0 deletions
55
src/main/java/org/fusionsoft/lib/ci/credentials/CredentialsOfScalar.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright (C) 2018-2021 FusionSoft | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* You may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
* either express or implied. | ||
* | ||
* See the License for the specific language governing permissions | ||
* and limitations under the License. | ||
*/ | ||
package org.fusionsoft.lib.ci.credentials; | ||
|
||
import org.cactoos.Scalar; | ||
import org.cactoos.scalar.Sticky; | ||
import org.cactoos.scalar.Unchecked; | ||
|
||
/** | ||
* The type of {@link Credentials} of {@link Scalar} delegate. | ||
* @since 0.1 | ||
*/ | ||
public class CredentialsOfScalar implements Credentials { | ||
|
||
/** | ||
* The Unchecked Scalar of Credentials encapsulated. | ||
*/ | ||
private final Unchecked<Credentials> scalar; | ||
|
||
/** | ||
* Instantiates a new Credentials envelope. | ||
* @param scalar The Scalar of Credentials to be encapsulated. | ||
*/ | ||
public CredentialsOfScalar(final Scalar<Credentials> scalar) { | ||
this.scalar = new Unchecked<>( | ||
new Sticky<>( | ||
scalar | ||
) | ||
); | ||
} | ||
|
||
@Override | ||
public final String username() { | ||
return this.scalar.value().username(); | ||
} | ||
|
||
@Override | ||
public final String password() { | ||
return this.scalar.value().password(); | ||
} | ||
|
||
} |
54 changes: 54 additions & 0 deletions
54
src/main/java/org/fusionsoft/lib/ci/credentials/SimpleCredentials.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright (C) 2018-2021 FusionSoft | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* You may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
* either express or implied. | ||
* | ||
* See the License for the specific language governing permissions | ||
* and limitations under the License. | ||
*/ | ||
package org.fusionsoft.lib.ci.credentials; | ||
|
||
/** | ||
* The type of {@link Credentials} that can be constructed of text values. | ||
* @since 0.1 | ||
*/ | ||
public class SimpleCredentials implements Credentials { | ||
|
||
/** | ||
* The String encapsulated. | ||
*/ | ||
private final String name; | ||
|
||
/** | ||
* The String encapsulated. | ||
*/ | ||
private final String pwd; | ||
|
||
/** | ||
* Instantiates a new Simple credentials. | ||
* @param username The String to be encapsulated. | ||
* @param password The String to be encapsulated. | ||
*/ | ||
public SimpleCredentials(final String username, final String password) { | ||
this.name = username; | ||
this.pwd = password; | ||
} | ||
|
||
@Override | ||
public final String username() { | ||
return this.name; | ||
} | ||
|
||
@Override | ||
public final String password() { | ||
return this.pwd; | ||
} | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/org/fusionsoft/lib/ci/credentials/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright (C) 2018-2021 FusionSoft | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* You may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
* either express or implied. | ||
* | ||
* See the License for the specific language governing permissions | ||
* and limitations under the License. | ||
*/ | ||
|
||
/** | ||
* The package for {@link org.fusionsoft.lib.ci.credentials.Credentials} | ||
* iface and implementations. | ||
*/ | ||
package org.fusionsoft.lib.ci.credentials; |
34 changes: 34 additions & 0 deletions
34
src/test/java/org/fusionsoft/database/ci/UrlOfPgTestDatabaseV11.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (C) 2018-2021 FusionSoft | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* You may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
* either express or implied. | ||
* | ||
* See the License for the specific language governing permissions | ||
* and limitations under the License. | ||
*/ | ||
package org.fusionsoft.database.ci; | ||
|
||
import org.cactoos.text.TextEnvelope; | ||
import org.cactoos.text.TextOfScalar; | ||
|
||
/** | ||
* The {@link org.cactoos.Text} of url of pg v.11 test instance. | ||
* @since 0.1 | ||
*/ | ||
public class UrlOfPgTestDatabaseV11 extends TextEnvelope { | ||
|
||
/** | ||
* Instantiates a new Url of pg test database v 11. | ||
*/ | ||
public UrlOfPgTestDatabaseV11() { | ||
super(new TextOfScalar(() -> "jdbc:postgresql://135.181.94.98:31107/")); | ||
} | ||
|
||
} |
Oops, something went wrong.