Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Open Subsurface Data Universe Software
Platform
System
Notification
Commits
82aae306
Commit
82aae306
authored
Sep 03, 2020
by
Komal Makkar
Browse files
minor changes
parents
99b49548
f11ec6d7
Pipeline
#7192
failed with stage
in 38 seconds
Changes
8
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
notification-core/src/main/java/org/opengroup/osdu/notification/api/PubsubEndpoint.java
View file @
82aae306
...
...
@@ -162,7 +162,7 @@ public class PubsubEndpoint {
throw
new
AppException
(
HttpStatus
.
SC_NOT_FOUND
,
"Not found subscription for notificationId:"
+
notificationId
,
"Subscription not found"
);
}
Subscription
subscription
=
s
ervice
.
query
(
notificationId
)
.
get
(
0
);
Subscription
subscription
=
s
ubscriptionList
.
get
(
0
);
String
jsonSubscription
=
gson
.
toJson
(
subscription
);
this
.
subscriptionCacheFactory
.
put
(
subscription
.
getNotificationId
(),
jsonSubscription
);
...
...
provider/notification-azure/src/main/java/org/opengroup/osdu/notification/provider/azure/util/ServiceAccountJwtAzureClientImpl.java
View file @
82aae306
...
...
@@ -58,7 +58,7 @@ public class ServiceAccountJwtAzureClientImpl implements IServiceAccountJwtClien
IdToken
cachedToken
=
(
IdToken
)
tenantJwtCache
.
get
(
tenant
.
getName
());
if
((
cachedToken
!=
null
)
&&
!
IdToken
.
refreshToken
(
cachedToken
))
{
return
cachedToken
.
getTokenValue
();
return
"Bearer "
+
cachedToken
.
getTokenValue
();
}
// TODO : Control the thread count via config and pool should be created once.
...
...
@@ -76,7 +76,7 @@ public class ServiceAccountJwtAzureClientImpl implements IServiceAccountJwtClien
service
.
shutdown
();
}
}
return
ACCESS_TOKEN
;
return
"Bearer "
+
ACCESS_TOKEN
;
}
// TODO : Refactor for making it test-able.
...
...
provider/notification-gcp/src/main/java/org/opengroup/osdu/notification/provider/gcp/pubsub/PubsubRequestBodyExtractor.java
View file @
82aae306
...
...
@@ -18,7 +18,7 @@ package org.opengroup.osdu.notification.provider.gcp.pubsub;
import
com.google.common.base.Strings
;
import
org.opengroup.osdu.core.common.logging.JaxRsDpsLog
;
import
org.opengroup.osdu.
notification.models
.MessageContent
;
import
org.opengroup.osdu.
core.common.model.storage
.MessageContent
;
import
org.opengroup.osdu.core.common.model.http.AppException
;
import
com.google.gson.Gson
;
...
...
@@ -81,6 +81,7 @@ public class PubsubRequestBodyExtractor implements IPubsubRequestBodyExtractor {
return
fullNotificationId
[
fullNotificationId
.
length
-
1
];
}
@Override
public
boolean
isHandshakeRequest
()
{
return
false
;
}
...
...
testing/notification-test-azure/pom.xml
View file @
82aae306
...
...
@@ -42,11 +42,11 @@
<distributionManagement>
<repository>
<id>
${gitlab-server}
</id>
<url>
https://community.opengroup.org/api/v4/projects/1
43
/packages/maven
</url>
<url>
https://community.opengroup.org/api/v4/projects/1
57
/packages/maven
</url>
</repository>
<snapshotRepository>
<id>
${gitlab-server}
</id>
<url>
https://community.opengroup.org/api/v4/projects/1
43
/packages/maven
</url>
<url>
https://community.opengroup.org/api/v4/projects/1
57
/packages/maven
</url>
</snapshotRepository>
</distributionManagement>
...
...
@@ -60,12 +60,33 @@
<dependency>
<groupId>
org.opengroup.osdu
</groupId>
<artifactId>
core-lib-azure
</artifactId>
<version>
0.0.17
</version>
<version>
0.0.22
</version>
<exclusions>
<exclusion>
<groupId>
io.projectreactor
</groupId>
<artifactId>
reactor-core
</artifactId>
</exclusion>
<exclusion>
<groupId>
io.projectreactor.netty
</groupId>
<artifactId>
reactor-netty
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
io.projectreactor
</groupId>
<artifactId>
reactor-core
</artifactId>
<version>
3.3.5.RELEASE
</version>
</dependency>
<dependency>
<groupId>
io.projectreactor.netty
</groupId>
<artifactId>
reactor-netty
</artifactId>
<version>
0.9.7.RELEASE
</version>
</dependency>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
4.12
</version>
<scope>
test
</scope>
</dependency>
</dependencies>
...
...
testing/notification-test-azure/src/test/java/org/opengroup/osdu/notification/api/PubsubEndpointHMACDescriptor.java
0 → 100644
View file @
82aae306
/*
* Copyright 2017-2020, Schlumberger
*
* 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.opengroup.osdu.notification.api
;
import
org.opengroup.osdu.notification.util.Config
;
import
org.opengroup.osdu.notification.util.RestDescriptor
;
import
org.opengroup.osdu.notification.util.TestUtils
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
PubsubEndpointHMACDescriptor
extends
RestDescriptor
{
@Override
public
String
getPath
()
{
return
"push-handlers/records-changed"
;
}
@Override
public
String
getHttpMethod
()
{
return
"POST"
;
}
@Override
public
String
getValidBody
()
{
return
"[{\n"
+
" \"id\": \"2425\",\n"
+
" \"eventType\": \"recordInserted\",\n"
+
" \"subject\": \"myapp/vehicles/motorcycles\",\n"
+
" \"data\": {\n"
+
" \"attributes\": {\n"
+
" \"correlation-id\": \"39137f49-67d6-4001-a6aa-15521ef4f49e\",\n"
+
" \"data-partition-id\": \""
+
TestUtils
.
getOsduTenant
()
+
"\"\n"
+
" },\n"
+
" \"data\": \"W3sia2luZCI6InRlc3RraW5kIiwiaWQiOiJ0ZXN0aWQiLCJvcGVyYXRpb250eXBlIjoiY3JlYXRlIn0seyJraW5kIjoidGVzdGtpbmQyIiwiaWQiOiJ0ZXN0aWQyIiwib3BlcmF0aW9udHlwZSI6InVwZGF0ZSJ9XQ\",\n"
+
" \"messageId\": \"136969346945\"\n"
+
" },\n"
+
" \"dataVersion\": \"1.0\",\n"
+
" \"metadataVersion\": \"1\",\n"
+
" \"eventTime\": \"2020-08-14T18:04:12+00:00\",\n"
+
" \"topic\": \"/subscriptions/c99e2bf3-1777-412b-baba-d823676589c2/resourceGroups/komakkar-OSDU-RG/providers/Microsoft.EventGrid/topics/recordChanged\"\n"
+
" }]"
;
}
@Override
public
Map
<
String
,
String
>
getOsduTenantHeaders
(){
Map
<
String
,
String
>
headers
=
new
HashMap
<>();
headers
.
put
(
"Aeg-Subscription-Name"
,
arg
());
headers
.
put
(
"data-partition-id"
,
Config
.
Instance
().
OsduTenant
);
return
headers
;
}
@Override
public
Map
<
String
,
String
>
getCustomerTenantHeaders
(){
Map
<
String
,
String
>
headers
=
new
HashMap
<>();
headers
.
put
(
"Aeg-Subscription-Name"
,
arg
());
headers
.
put
(
"data-partition-id"
,
Config
.
Instance
().
ClientTenant
);
return
headers
;
}
}
testing/notification-test-core/pom.xml
View file @
82aae306
...
...
@@ -69,7 +69,17 @@
<dependency>
<groupId>
org.opengroup.osdu
</groupId>
<artifactId>
os-core-common
</artifactId>
<version>
0.3.6
</version>
<version>
0.3.4
</version>
<exclusions>
<exclusion>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-logging
</artifactId>
</exclusion>
<exclusion>
<groupId>
org.apache.logging.log4j
</groupId>
<artifactId>
log4j-api
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
javax.json
</groupId>
...
...
testing/notification-test-core/src/main/java/org/opengroup/osdu/notification/api/PubsubEndpointGSADescriptor.java
View file @
82aae306
...
...
@@ -44,7 +44,7 @@ public class PubsubEndpointGSADescriptor extends RestDescriptor {
"\t\"data-partition-id\": \""
+
TestUtils
.
getOsduTenant
()
+
"\"},\n"
+
"\t\"data\": \"W3sia2luZCI6InRlc3RraW5kIiwiaWQiOiJ0ZXN0aWQiLCJvcGVyYXRpb250eXBlIjoiY3JlYXRlIn0seyJraW5kIjoidGVzdGtpbmQyIiwiaWQiOiJ0ZXN0aWQyIiwib3BlcmF0aW9udHlwZSI6InVwZGF0ZSJ9XQ\",\n"
+
"\t\"messageId\": \"136969346945\"},\n"
+
"\t\"subscription\":\""
+
arg
()
+
"\"\n"
+
"\t\"subscription\":\""
+
Config
.
Instance
().
NotificationId
+
"\"\n"
+
"}"
;
}
...
...
testing/notification-test-core/src/main/java/org/opengroup/osdu/notification/util/Config.java
View file @
82aae306
...
...
@@ -32,16 +32,15 @@ public class Config {
private
static
Config
config
=
new
Config
();
public
static
Config
Instance
()
{
String
env
=
"LOCAL"
;
//
getEnvironment();
String
env
=
getEnvironment
();
config
.
ClientTenant
=
"nonexistenttenant"
;
config
.
IntegrationAudience
=
"245464679631-ktfdfpl147m1mjpbutl00b3cmffissgq.apps.googleusercontent.com"
;
config
.
OsduTenant
=
"opendes"
;
config
.
Topic
=
"records-changed"
;
config
.
hmacSecretValue
=
""
;
//System.getProperty("HMAC_SECRET", System.getenv("HMAC_SECRET"));
config
.
hmacSecretValue
=
System
.
getProperty
(
"HMAC_SECRET"
,
System
.
getenv
(
"HMAC_SECRET"
));
if
(
env
.
equalsIgnoreCase
(
"LOCAL"
))
{
//make sure to run register service on a different port. You can also choose to point to Register service that is running in cloud
String
registerUrl
=
"http://localhost:8081/"
;
String
registerUrl
=
"http://localhost:8081/
api/register/v1
"
;
//must have notification and register services running on different ports
config
.
HostUrl
=
"http://localhost:8082/"
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment