Skip to content

WIP: No SQL Module #44

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

Draft
wants to merge 52 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
ad360ab
Started working on MongoDB functionality.
jonreding2010 Aug 11, 2020
ee11665
Continued progress, Config unit tests are only ones that still work.
jonreding2010 Aug 11, 2020
2d2dcef
Working on tests
jonreding2010 Aug 12, 2020
ae19537
more work on unit tests
jonreding2010 Sep 3, 2020
29c0b18
updates
jonreding2010 Sep 18, 2020
6d0fb62
continued working on MongoDB stuff, now to figure out why MongoDbDriv…
jonreding2010 Jan 10, 2021
77e9657
working on tests
jonreding2010 Jan 11, 2021
bb74e6f
driver update
jonreding2010 Jan 14, 2021
482fe4a
Merge branch 'master' into MongoDB
jonreding2010 Jan 22, 2021
2a9e9fc
more work on unit tests
jonreding2010 Jan 23, 2021
d307ede
Changed to actual mongoDB repo
jonreding2010 Jan 28, 2021
389b376
updated pom
jonreding2010 Jan 28, 2021
caf6cce
checkstyle changes
jonreding2010 Jun 4, 2021
60ce692
Merge branch 'master' into MongoDB
jonreding2010 Jun 4, 2021
b881d01
added MongoDB as dependency in framework .pom
jonreding2010 Jun 9, 2021
4099d2c
Merge branch 'master' into MongoDB
jonreding2010 Jun 9, 2021
63eb864
checkstyle updates
jonreding2010 Jun 9, 2021
8663ef4
checkstyle updates
jonreding2010 Jun 9, 2021
b1572c9
updated mongodb driver version
jonreding2010 Jun 11, 2021
b799ba2
Merge branch 'master' into MongoDB
jonreding2010 Oct 18, 2021
a7e7df8
added comments
jonreding2010 Oct 18, 2021
245bb18
add docker stuff for mongo db
jredingcsv Jan 23, 2022
9b0aeed
Merge branch 'main' into MongoDB
jredingcsv Jan 23, 2022
141c4eb
more edits for mongo db
jredingcsv Jan 23, 2022
8a3b8a7
added content for mongo db
jredingcsv Jan 23, 2022
6be5f12
added content for mongo db
jredingcsv Jan 24, 2022
1465dea
Merge branch 'main' into NoSQL
jredingcsv Feb 18, 2022
82aeca5
import updates
jredingcsv Feb 18, 2022
f0b0f5d
Merge branch 'main' into NoSQL
jredingcsv Mar 7, 2022
645d65c
updated nosql comments
jredingcsv Mar 7, 2022
6b511ae
copyright update
jredingcsv Mar 8, 2022
4b3698c
copyright update
jredingcsv Mar 8, 2022
44373fa
updated to set up mongo docker
jredingcsv Mar 10, 2022
5cfd803
Merge branch 'main' into NoSQL
jredingcsv Apr 12, 2022
2677b1c
Merge branch 'Add_Interfaces' into NoSQL
jredingcsv Apr 12, 2022
d31d46d
small edits
jredingcsv Apr 13, 2022
6e53965
small edits
jredingcsv Apr 13, 2022
c565353
small edits
jredingcsv Apr 13, 2022
a647e93
small edits
jredingcsv Apr 13, 2022
1abf5d1
Merge branch 'main' into NoSQL
jredingcsv Apr 14, 2022
a894a01
update docker
jredingcsv Apr 14, 2022
42ccfcc
Merge branch 'main' into NoSQL
jredingcsv Apr 15, 2022
0434431
updated some stuff
jredingcsv Apr 15, 2022
5773221
Merge branch 'main' into NoSQL
jredingcsv Apr 29, 2022
6329afe
Merge branch 'main' into NoSQL
jredingcsv May 5, 2022
da4f6cb
add nosql module to maven.yml
jredingcsv May 5, 2022
5664002
checkstyle updates
jredingcsv May 5, 2022
ac5e37e
Merge branch 'main' into NoSQL
jredingcsv Jun 22, 2022
f8420da
Merge branch 'main' into NoSQL
jredingcsv Sep 14, 2022
fdc877e
more updates
jredingcsv Sep 14, 2022
d93231a
manage port as quotes
jredingcsv Sep 16, 2022
e5eb785
Merge branch 'main' into NoSQL
jredingcsv Oct 24, 2022
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
4 changes: 4 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@ accessibility:
playwright:
- maqs-playwright/*
- maqs-playwright/**/*

noSQL:
-maqs-nosql/*
-maqs-nosql/**/*
2 changes: 1 addition & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ jobs:
strategy:
fail-fast: false
matrix:
module-name: [ maqs-utilities, maqs-base, maqs-appium, maqs-selenium, maqs-webservices, maqs-cucumber, maqs-accessibility, maqs-database, maqs-playwright ]
module-name: [ maqs-utilities, maqs-base, maqs-appium, maqs-selenium, maqs-webservices, maqs-cucumber, maqs-accessibility, maqs-database, maqs-playwright, maqs-nosql ]
steps:
- name: Check if tests can be run
if: matrix.module-name == 'maqs-appium' && github.actor == 'dependabot[bot]'
Expand Down
23 changes: 23 additions & 0 deletions Docker/MAQSMongoDB/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: '2'

services:
mongo:
image: mongo
restart: always
ports:
- "27017:27017"
volumes:
- ./seed/seed.js:/docker-entrypoint-initdb.d/seed.js
mongo-express:
image: mongo-express
restart: always
ports:
- 8081:8081
links:
- mongo
environment:
ME_CONFIG_MONGODB_ADMINUSERNAME:
ME_CONFIG_MONGODB_ADMINPASSWORD:

# Run a custom bash script that bootstraps the database after it is started.
command: [ '/bin/bash', '/mnt/host/initialize_and_start_sqlserver.sh' ]
22 changes: 22 additions & 0 deletions Docker/MAQSMongoDB/seed/seed.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
db = db.getSiblingDB('MongoDatabaseTest')
db.MongoTestCollection.drop();
db.MongoTestCollection.insertMany([
{
"lid": "test1",
"isChanged": true,
"order": 1
},
{
"lid": "test2",
"isChanged": false,
"order": 2
},
{
"lid": "test3",
"isChanged": false
},
{
"lid": "test4",
"isChanged": false
}
])
15 changes: 15 additions & 0 deletions Docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# The extends functionality is not yet available in
# Docker config files versioned 3 and higher.
# If the version is bumped, this config file will have to change.
# See https://github.com/moby/moby/issues/31101.
version: '2'

services:
mssql:
extends:
file: ./MAQSSQLServer/docker-compose.yml
service: mssql
mongo:
extends:
file: ./MAQSMongoDB/docker-compose.yml
service: mongo
13 changes: 8 additions & 5 deletions docker/MAQSMongoDB/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ version: '2'
services:
mongo:
image: mongo
restart: always
restart: always
ports:
- "27017:27017"
- "27017:27017"
volumes:
- ./seed/seed.js:/docker-entrypoint-initdb.d/seed.js
- ./seed/seed.js:/docker-entrypoint-initdb.d/seed.js
mongo-express:
image: mongo-express
restart: always
Expand All @@ -16,5 +16,8 @@ services:
links:
- mongo
environment:
ME_CONFIG_MONGODB_ADMINUSERNAME:
ME_CONFIG_MONGODB_ADMINPASSWORD:
ME_CONFIG_MONGODB_ADMINUSERNAME:
ME_CONFIG_MONGODB_ADMINPASSWORD:

# Run a custom bash script that bootstraps the database after it is started.
command: [ '/bin/bash', '/mnt/host/initialize_and_start_sqlserver.sh' ]
2 changes: 1 addition & 1 deletion docker/MAQSMongoDB/seed/seed.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ db.MongoTestCollection.insertMany([
"lid": "test4",
"isChanged": false
}
])
])
12 changes: 2 additions & 10 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,10 @@ version: '2'

services:
mssql:
extends:
extends:
file: ./MAQSSQLServer/docker-compose.yml
service: mssql
mongo:
extends:
file: ./MAQSMongoDB/docker-compose.yml
service: mongo
imap:
extends:
file: ./MAQSEmail/docker-compose.yml
service: imap
webservice:
extends:
service: webservice
file: ./MAQSService/docker-compose.yml
service: mongo
41 changes: 41 additions & 0 deletions maqs-nosql/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>

<configuration>
<ModualMaqs>
<!-- Generic wait time in milliseconds - AKA how long do you wait for rechecking something -->
<WaitTime>100</WaitTime>

<!-- Generic time-out in milliseconds -->
<Timeout>10000</Timeout>

<!-- Do you want to create logs for your tests
<Log>YES</Log>
<Log>NO</Log>
<Log>OnFail</Log>-->
<Log>YES</Log>

<!--Logging Levels
<LogLevel>VERBOSE</LogLevel>
<LogLevel>INFORMATION</LogLevel>
<LogLevel>GENERIC</LogLevel>
<LogLevel>SUCCESS</LogLevel>
<LogLevel>WARNING</LogLevel>
<LogLevel>ERROR</LogLevel>-->
<LogLevel>VERBOSE</LogLevel>

<!-- Logging Types
<LogType>CONSOLE</LogType>
<LogType>TXT</LogType>
<LogType>HTML</LogType>-->
<LogType>TXT</LogType>

<!-- Log file path - Defaults to build location if no value is defined -->
<FileLoggerPath>./target/logs</FileLoggerPath>
</ModualMaqs>
<MongoMaqs>
<MongoConnectionString>mongodb://localhost:27017</MongoConnectionString>
<MongoDatabase>MongoDatabaseTest</MongoDatabase>
<MongoCollection>MongoTestCollection</MongoCollection>
<MongoTimeout>30</MongoTimeout>
</MongoMaqs>
</configuration>
44 changes: 44 additions & 0 deletions maqs-nosql/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.cognizantsoftvision.maqs</groupId>
<artifactId>maqs-java</artifactId>
<version>${revision}</version>
</parent>

<groupId>com.cognizantsoftvision.maqs.noSQL</groupId>
<artifactId>maqs-noSQL</artifactId>
<name>MAQS NoSQL Testing Module</name>
<version>${revision}</version>

<properties>
<mongoDB.version>4.5.0</mongoDB.version>
</properties>

<dependencies>
<dependency>
<groupId>com.cognizantsoftvision.maqs.base</groupId>
<artifactId>maqs-base</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.cognizantsoftvision.maqs.utilities</groupId>
<artifactId>maqs-utilities</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-sync</artifactId>
<version>${mongoDB.version}</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/*
* Copyright 2022 (C) Cognizant SoftVision, All rights Reserved
*/

package com.cognizantsoftvision.maqs.nosql;

import com.cognizantsoftvision.maqs.base.BaseExtendableTest;
import com.mongodb.client.MongoCollection;
import java.util.function.Supplier;
import org.bson.Document;
import org.testng.ITestResult;

/**
* The Base Mongo Test class.
*/
public class BaseMongoTest extends BaseExtendableTest<MongoTestObject> {

/**
* Initializes a new instance of the BaseMongoTest class,
* Set up the database client for each test class.
*/
public BaseMongoTest() {
// Currently, not populated with any logic
}

/**
* Gets the mongoDB driver.
* @return the mongoDB driver
*/
public MongoDBDriver getMongoDBDriver() {
return this.getTestObject().getMongoDBDriver();
}

/**
* Sets the MongoDB driver.
* @param driver the MongoDB driver to be set.
*/
public void setMongoDBDriver(MongoDBDriver driver) {
this.getTestObject().overrideMongoDBDriver(driver);
}

/**
* Override the Mongo driver - does not lazy load.
* @param driver New Mongo driver
*/
public void overrideConnectionDriver(MongoDBDriver driver) {
this.getTestObject().overrideMongoDBDriver(driver);
}

/**
* Override the Mongo driver - respects lazy loading.
* @param overrideCollectionConnection The collection function
*/
public void overrideConnectionDriver(Supplier<MongoCollection<Document>> overrideCollectionConnection) {
this.getTestObject().overrideMongoDBDriver(overrideCollectionConnection);
}

/**
* Override the Mongo driver - respects lazy loading.
* @param connectionString Client connection string
* @param databaseString Database connection string
* @param collectionString Mongo collection string
*/
public void overrideConnectionDriver(String connectionString, String databaseString, String collectionString) {
this.getTestObject().overrideMongoDBDriver(connectionString, databaseString, collectionString);
}

/**
* Get the base web service url.
* @return The base web service url
*/
protected String getBaseConnectionString() {
return MongoDBConfig.getConnectionString();
}

/**
* Get the base web service url.
* @return The base web service url
*/
protected String getBaseDatabaseString() {
return MongoDBConfig.getDatabaseString();
}

/**
* Get the base web service url.
* @return The base web service url
*/
protected String getBaseCollectionString() {
return MongoDBConfig.getCollectionString();
}

@Override
protected void createNewTestObject() {
this.setTestObject(new MongoTestObject(this.getBaseConnectionString(), this.getBaseDatabaseString(),
this.getBaseCollectionString(), this.createLogger(), this.getFullyQualifiedTestClassName()));
}

/**
* Steps to take before logging teardown results.
* @param resultType The test result
*/
@Override
protected void beforeLoggingTeardown(ITestResult resultType) {
// Currently, not populated with any logic
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright 2022 (C) Cognizant SoftVision, All rights Reserved
*/

package com.cognizantsoftvision.maqs.nosql;

import com.cognizantsoftvision.maqs.base.ITestObject;
import com.mongodb.client.MongoCollection;
import java.util.function.Supplier;
import org.bson.Document;

/**
* The Mongo Test Object interface.
*/
public interface IMongoTestObject extends ITestObject {

/**
* Gets the Mongo driver.
* @return the mongo database driver
*/
MongoDBDriver getMongoDBDriver();

/**
* Gets the Mongo driver manager.
* @return the mongo database manager
*/
MongoDriverManager getMongoDBManager();

/**
* Override the Mongo driver a collection function.
* @param overrideCollectionConnection The collection function
*/
void overrideMongoDBDriver(Supplier<MongoCollection<Document>> overrideCollectionConnection);

/**
* Override the Mongo driver settings.
* @param driver New Mongo driver
*/
void overrideMongoDBDriver(MongoDBDriver driver);

/**
* Override the Mongo driver settings.
* @param connectionString Client connection string
* @param databaseString Database connection string
* @param collectionString Mongo collection string
*/
void overrideMongoDBDriver(String connectionString, String databaseString, String collectionString);
}
Loading