Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
alfa
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OZG-Cloud
app
alfa
Commits
8d4cd7a8
Commit
8d4cd7a8
authored
2 years ago
by
OZGCloud
Browse files
Options
Downloads
Patches
Plain Diff
OZG-2737 OZG-2950 adjust drop usermanager collections
parent
37990412
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
goofy-client/apps/goofy-e2e/src/plugins/index.js
+34
-28
34 additions, 28 deletions
goofy-client/apps/goofy-e2e/src/plugins/index.js
goofy-client/apps/goofy-e2e/src/support/cypress-helper.ts
+3
-2
3 additions, 2 deletions
goofy-client/apps/goofy-e2e/src/support/cypress-helper.ts
with
37 additions
and
30 deletions
goofy-client/apps/goofy-e2e/src/plugins/index.js
+
34
−
28
View file @
8d4cd7a8
...
@@ -56,6 +56,11 @@ module.exports = (on, config) => {
...
@@ -56,6 +56,11 @@ module.exports = (on, config) => {
console
.
log
(
'
dropCollections:
'
,
collections
);
console
.
log
(
'
dropCollections:
'
,
collections
);
dropCollectionsFromDatabase
(
config
,
collections
);
dropCollectionsFromDatabase
(
config
,
collections
);
return
0
;
return
0
;
},
dropUserManagerCollections
(
collections
)
{
console
.
log
(
'
dropUserManagerCollections:
'
,
collections
);
dropUserManagerCollectionsFromDatabase
(
config
,
collections
);
return
0
;
}
}
});
});
...
@@ -215,11 +220,19 @@ function createNumberLong(numberValue){
...
@@ -215,11 +220,19 @@ function createNumberLong(numberValue){
}
}
function
insertIntoDatabase
(
config
,
collection
,
data
)
{
function
insertIntoDatabase
(
config
,
collection
,
data
)
{
MongoClient
.
connect
(
buildDatabaseUrl
(
config
),
(
error
,
connection
)
=>
{
insert
(
getDatabaseUrl
(
config
),
getDatabase
(
config
),
collection
,
data
);
}
function
insertIntoUserManagerDatabase
(
config
,
collection
,
data
){
insert
(
getUserManagerDatabaseUrl
(
config
),
getUserManagerDatabase
(
config
),
collection
,
data
);
}
function
insert
(
databaseUrl
,
databaseName
,
collection
,
data
){
MongoClient
.
connect
(
databaseUrl
,
(
error
,
connection
)
=>
{
console
.
log
(
'
connect to database...
'
)
console
.
log
(
'
connect to database...
'
)
if
(
!
error
)
{
if
(
!
error
)
{
console
.
log
(
'
success
'
);
console
.
log
(
'
success
'
);
var
db
=
connection
.
db
(
config
.
env
.
database
);
var
db
=
connection
.
db
(
database
Name
);
db
.
collection
(
collection
).
drop
(()
=>
{
db
.
collection
(
collection
).
drop
(()
=>
{
db
.
createCollection
(
collection
,
(
error
)
=>
handleCreateCollection
(
db
,
connection
,
collection
,
data
,
error
));
db
.
createCollection
(
collection
,
(
error
)
=>
handleCreateCollection
(
db
,
connection
,
collection
,
data
,
error
));
...
@@ -253,12 +266,29 @@ function handleInsertMany(connection, error) {
...
@@ -253,12 +266,29 @@ function handleInsertMany(connection, error) {
}
}
function
dropCollectionsFromDatabase
(
config
,
collections
)
{
function
dropCollectionsFromDatabase
(
config
,
collections
)
{
MongoClient
.
connect
(
buildDatabaseUrl
(
config
),
(
error
,
connection
)
=>
{
dropCollections
(
getDatabaseUrl
(
config
),
getDatabase
(
config
),
collections
);
}
function
getDatabaseUrl
(
config
){
return
config
.
env
.
dbUrl
;
}
function
getDatabase
(
config
){
return
config
.
env
.
database
}
function
dropUserManagerCollectionsFromDatabase
(
config
,
collections
){
dropCollections
(
getUserManagerDatabaseUrl
(
config
),
getUserManagerDatabase
(
config
),
collections
);
}
function
dropCollections
(
databaseUrl
,
databaseName
,
collections
){
MongoClient
.
connect
(
databaseUrl
,
(
error
,
connection
)
=>
{
if
(
!
error
)
{
if
(
!
error
)
{
var
db
=
connection
.
db
(
config
.
env
.
database
);
var
db
=
connection
.
db
(
database
Name
);
collections
.
forEach
((
oneCollection
,
index
)
=>
{
collections
.
forEach
((
oneCollection
,
index
)
=>
{
console
.
log
(
'
drop collection
'
,
oneCollection
);
console
.
log
(
'
drop collection
'
,
oneCollection
);
db
.
collection
(
oneCollection
).
drop
(()
=>
{
db
.
collection
(
oneCollection
).
drop
(()
=>
{
//CHECKME Ist die Abfrage notwendig?
if
(
index
==
collections
.
length
){
if
(
index
==
collections
.
length
){
console
.
log
(
'
close connection
'
);
console
.
log
(
'
close connection
'
);
connection
.
close
();
connection
.
close
();
...
@@ -268,27 +298,3 @@ function dropCollectionsFromDatabase(config, collections) {
...
@@ -268,27 +298,3 @@ function dropCollectionsFromDatabase(config, collections) {
}
}
});
});
}
}
\ No newline at end of file
function
buildDatabaseUrl
(
config
)
{
return
config
.
env
.
dbUrl
;
}
function
insertIntoUserManagerDatabase
(
config
,
collection
,
data
){
MongoClient
.
connect
(
buildUsermanagerDatabaseUrl
(
config
),
(
error
,
connection
)
=>
{
console
.
log
(
'
connect to database...
'
)
if
(
!
error
)
{
console
.
log
(
'
success
'
);
var
db
=
connection
.
db
(
config
.
env
.
userManager
.
database
);
db
.
collection
(
collection
).
drop
(()
=>
{
db
.
createCollection
(
collection
,
(
error
)
=>
handleCreateCollection
(
db
,
connection
,
collection
,
data
,
error
));
});
}
else
{
console
.
log
(
'
fail
'
,
error
);
}
});
}
function
buildUsermanagerDatabaseUrl
(
config
){
return
config
.
env
.
userManager
.
dbUrl
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
goofy-client/apps/goofy-e2e/src/support/cypress-helper.ts
+
3
−
2
View file @
8d4cd7a8
...
@@ -6,8 +6,8 @@ import { VorgangE2E } from '../model/vorgang';
...
@@ -6,8 +6,8 @@ import { VorgangE2E } from '../model/vorgang';
import
{
VorgangAttachedItemE2E
}
from
'
../model/vorgang-attached-item
'
;
import
{
VorgangAttachedItemE2E
}
from
'
../model/vorgang-attached-item
'
;
enum
CypressTasks
{
enum
CypressTasks
{
DROP_COLLECTION
=
'
dropCollection
'
,
DROP_COLLECTIONS
=
'
dropCollections
'
,
DROP_COLLECTIONS
=
'
dropCollections
'
,
DROP_USER_MANAGER_COLLECTIONS
=
'
dropUserManagerCollections
'
,
INIT_COMMAND_DATA
=
'
initCommandData
'
,
INIT_COMMAND_DATA
=
'
initCommandData
'
,
INIT_GRID_FS_FILE_DATA
=
'
initGridFsFileData
'
,
INIT_GRID_FS_FILE_DATA
=
'
initGridFsFileData
'
,
INIT_GRID_FS_CHUNK_DATA
=
'
initGridFsChunkData
'
,
INIT_GRID_FS_CHUNK_DATA
=
'
initGridFsChunkData
'
,
...
@@ -80,7 +80,8 @@ export function initUsermanagerData(data: UsermanagerUserE2E[]): void {
...
@@ -80,7 +80,8 @@ export function initUsermanagerData(data: UsermanagerUserE2E[]): void {
}
}
export
function
dropCollections
()
{
export
function
dropCollections
()
{
cy
.
task
(
CypressTasks
.
DROP_COLLECTIONS
,
[
MongoCollections
.
COMMAND
,
MongoCollections
.
VORGANG
,
MongoCollections
.
VORGANG_ATTACHED_ITEM
,
MongoCollections
.
FS_FILES
,
MongoCollections
.
FS_CHUNKS
,
MongoCollections
.
USER
]);
cy
.
task
(
CypressTasks
.
DROP_COLLECTIONS
,
[
MongoCollections
.
COMMAND
,
MongoCollections
.
VORGANG
,
MongoCollections
.
VORGANG_ATTACHED_ITEM
,
MongoCollections
.
FS_FILES
,
MongoCollections
.
FS_CHUNKS
]);
cy
.
task
(
CypressTasks
.
DROP_USER_MANAGER_COLLECTIONS
,
[
MongoCollections
.
USER
]);
}
}
export
function
scrollToWindowBottom
():
void
{
export
function
scrollToWindowBottom
():
void
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment