Skip to content
GitLab
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
Indexer
Commits
e9168f53
Commit
e9168f53
authored
Dec 12, 2020
by
Anastasiia Gelmut
Committed by
Rostislav Dublin (EPAM)
Dec 12, 2020
Browse files
GONRG-844 Rewrite ElasticClientHandlerTest
-Updated ElasticClientHandlerTest.java.
parent
0be30c8f
Changes
19
Hide whitespace changes
Inline
Side-by-side
provider/indexer-gcp/src/main/java/org/opengroup/osdu/indexer/IndexerGcpApplication.java
View file @
e9168f53
/*
Copyright 2020 Google LLC
Copyright 2020 EPAM Systems, Inc
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.indexer
;
import
org.springframework.boot.SpringApplication
;
...
...
provider/indexer-gcp/src/main/java/org/opengroup/osdu/indexer/ServletInitializer.java
View file @
e9168f53
/*
Copyright 2020 Google LLC
Copyright 2020 EPAM Systems, Inc
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.indexer
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
...
...
provider/indexer-gcp/src/main/java/org/opengroup/osdu/indexer/cache/AttributesCache.java
View file @
e9168f53
...
...
@@ -14,13 +14,12 @@
package
org.opengroup.osdu.indexer.cache
;
import
javax.inject.Inject
;
import
org.opengroup.osdu.core.common.cache.RedisCache
;
import
org.opengroup.osdu.core.common.model.search.ClusterSettings
;
import
org.opengroup.osdu.core.common.provider.interfaces.IAttributesCache
;
import
org.opengroup.osdu.indexer.config.IndexerConfigurationProperties
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
javax.inject.Inject
;
import
java.util.Set
;
@Component
...
...
provider/indexer-gcp/src/main/java/org/opengroup/osdu/indexer/cache/DatastoreCredentialCache.java
View file @
e9168f53
...
...
@@ -18,14 +18,13 @@ import com.google.auth.oauth2.AccessToken;
import
org.opengroup.osdu.core.common.cache.RedisCache
;
import
org.opengroup.osdu.indexer.config.IndexerConfigurationProperties
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
@Component
public
class
DatastoreCredentialCache
extends
RedisCache
<
String
,
AccessToken
>
{
@Autowired
public
DatastoreCredentialCache
(
final
IndexerConfigurationProperties
configurationProperties
)
{
super
(
configurationProperties
.
getRedisSearchHost
(),
Integer
.
parseInt
(
configurationProperties
.
getRedisSearchPort
()),
58
*
60
,
String
.
class
,
AccessToken
.
class
);
}
@Autowired
public
DatastoreCredentialCache
(
final
IndexerConfigurationProperties
configurationProperties
)
{
super
(
configurationProperties
.
getRedisSearchHost
(),
Integer
.
parseInt
(
configurationProperties
.
getRedisSearchPort
()),
58
*
60
,
String
.
class
,
AccessToken
.
class
);
}
}
\ No newline at end of file
provider/indexer-gcp/src/main/java/org/opengroup/osdu/indexer/cache/ElasticCredentialsCache.java
View file @
e9168f53
/*
Copyright 2020 Google LLC
Copyright 2020 EPAM Systems, Inc
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.indexer.cache
;
import
javax.inject.Inject
;
import
org.opengroup.osdu.core.common.cache.RedisCache
;
import
org.opengroup.osdu.core.common.model.search.ClusterSettings
;
import
org.opengroup.osdu.core.common.provider.interfaces.IElasticCredentialsCache
;
import
org.opengroup.osdu.indexer.config.IndexerConfigurationProperties
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
javax.inject.Inject
;
@Component
public
class
ElasticCredentialsCache
implements
IElasticCredentialsCache
<
String
,
ClusterSettings
>,
AutoCloseable
{
...
...
provider/indexer-gcp/src/main/java/org/opengroup/osdu/indexer/cache/IndexCache.java
View file @
e9168f53
/*
Copyright 2020 Google LLC
Copyright 2020 EPAM Systems, Inc
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.indexer.cache
;
import
javax.inject.Inject
;
import
org.opengroup.osdu.core.common.cache.RedisCache
;
import
org.opengroup.osdu.core.common.model.search.ClusterSettings
;
import
org.opengroup.osdu.core.common.provider.interfaces.IIndexCache
;
import
org.opengroup.osdu.indexer.config.IndexerConfigurationProperties
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
javax.inject.Inject
;
@Component
public
class
IndexCache
implements
IIndexCache
<
String
,
Boolean
>,
AutoCloseable
{
private
RedisCache
<
String
,
Boolean
>
cache
;
...
...
provider/indexer-gcp/src/main/java/org/opengroup/osdu/indexer/cache/JwtCache.java
View file @
e9168f53
/*
Copyright 2020 Google LLC
Copyright 2020 EPAM Systems, Inc
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.indexer.cache
;
import
javax.inject.Inject
;
import
org.opengroup.osdu.core.common.cache.RedisCache
;
import
org.opengroup.osdu.core.common.model.search.IdToken
;
import
org.opengroup.osdu.core.common.provider.interfaces.IJwtCache
;
import
org.opengroup.osdu.indexer.config.IndexerConfigurationProperties
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
javax.inject.Inject
;
@Component
public
class
JwtCache
implements
IJwtCache
<
String
,
IdToken
>,
AutoCloseable
{
RedisCache
<
String
,
IdToken
>
cache
;
// google service account id_token can be requested only for 1 hr
private
final
static
int
EXPIRED_AFTER
=
59
;
private
static
final
int
EXPIRED_AFTER
=
59
;
@Inject
public
JwtCache
(
final
IndexerConfigurationProperties
properties
)
{
cache
=
new
RedisCache
<>(
properties
.
getRedisSearchHost
(),
Integer
.
parseInt
(
properties
.
getRedisSearchPort
()),
...
...
provider/indexer-gcp/src/main/java/org/opengroup/osdu/indexer/cache/KindsCache.java
View file @
e9168f53
/*
Copyright 2020 Google LLC
Copyright 2020 EPAM Systems, Inc
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.indexer.cache
;
import
javax.inject.Inject
;
import
org.opengroup.osdu.core.common.cache.RedisCache
;
import
org.opengroup.osdu.core.common.provider.interfaces.IKindsCache
;
import
org.opengroup.osdu.indexer.config.IndexerConfigurationProperties
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
javax.inject.Inject
;
import
java.util.Set
;
@Component
...
...
provider/indexer-gcp/src/main/java/org/opengroup/osdu/indexer/cache/SchemaCache.java
View file @
e9168f53
/*
Copyright 2020 Google LLC
Copyright 2020 EPAM Systems, Inc
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.indexer.cache
;
import
javax.inject.Inject
;
import
org.opengroup.osdu.core.common.cache.RedisCache
;
import
org.opengroup.osdu.core.common.model.search.ClusterSettings
;
import
org.opengroup.osdu.indexer.config.IndexerConfigurationProperties
;
import
org.opengroup.osdu.indexer.provider.interfaces.ISchemaCache
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
javax.inject.Inject
;
@Component
public
class
SchemaCache
implements
ISchemaCache
<
String
,
String
>,
AutoCloseable
{
private
RedisCache
<
String
,
String
>
cache
;
...
...
provider/indexer-gcp/src/main/java/org/opengroup/osdu/indexer/di/DatastoreCredentialsCacheFactory.java
View file @
e9168f53
/*
Copyright 2020 Google LLC
Copyright 2020 EPAM Systems, Inc
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.indexer.di
;
import
org.opengroup.osdu.core.common.cache.ICache
;
...
...
provider/indexer-gcp/src/main/java/org/opengroup/osdu/indexer/di/EntitlementsClientFactory.java
View file @
e9168f53
...
...
@@ -31,10 +31,10 @@ import org.springframework.web.context.annotation.RequestScope;
public
class
EntitlementsClientFactory
extends
AbstractFactoryBean
<
IEntitlementsFactory
>
{
@Value
(
"${AUTHORIZE_API}"
)
private
String
AUTHORIZE_API
;
private
String
authorizeApi
;
@Value
(
"${AUTHORIZE_API_KEY:}"
)
private
String
AUTHORIZE_API_KEY
;
private
String
authorizeApiKey
;
@Autowired
private
HttpResponseBodyMapper
mapper
;
...
...
@@ -44,8 +44,8 @@ public class EntitlementsClientFactory extends AbstractFactoryBean<IEntitlements
return
new
EntitlementsFactory
(
EntitlementsAPIConfig
.
builder
()
.
rootUrl
(
AUTHORIZE_API
)
.
apiKey
(
AUTHORIZE_API_KEY
)
.
rootUrl
(
authorizeApi
)
.
apiKey
(
authorizeApiKey
)
.
build
(),
mapper
);
}
...
...
provider/indexer-gcp/src/main/java/org/opengroup/osdu/indexer/di/PubSubExtensionsFactory.java
View file @
e9168f53
/*
Copyright 2020 Google LLC
Copyright 2020 EPAM Systems, Inc
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.indexer.di
;
import
org.opengroup.osdu.core.gcp.PubSub.PubSubExtensions
;
...
...
provider/indexer-gcp/src/main/java/org/opengroup/osdu/indexer/middleware/IndexFilter.java
View file @
e9168f53
/*
Copyright 2020 Google LLC
Copyright 2020 EPAM Systems, Inc
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.indexer.middleware
;
import
com.google.common.base.Strings
;
import
lombok.extern.java.Log
;
import
org.apache.http.HttpStatus
;
import
org.opengroup.osdu.core.common.model.http.DpsHeaders
;
import
org.opengroup.osdu.core.common.model.http.AppException
;
import
org.opengroup.osdu.core.common.http.ResponseHeaders
;
import
org.opengroup.osdu.core.common.model.http.AppException
;
import
org.opengroup.osdu.core.common.model.http.DpsHeaders
;
import
org.opengroup.osdu.core.common.model.search.DeploymentEnvironment
;
import
org.opengroup.osdu.core.common.provider.interfaces.IRequestInfo
;
import
org.opengroup.osdu.indexer.config.IndexerConfigurationProperties
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.stereotype.Component
;
...
...
@@ -35,14 +51,11 @@ public class IndexFilter implements Filter {
@Inject
private
IndexerConfigurationProperties
properties
;
private
FilterConfig
filterConfig
;
private
static
final
String
PATH_SWAGGER
=
"/swagger.json"
;
private
static
final
String
PATH_TASK_HANDLERS
=
"task-handlers"
;
private
static
final
String
PATH_CRON_HANDLERS
=
"cron-handlers"
;
@Override
public
void
init
(
FilterConfig
filterConfig
)
throws
ServletException
{
public
void
init
(
FilterConfig
filterConfig
)
{
}
@Override
...
...
@@ -61,10 +74,6 @@ public class IndexFilter implements Filter {
checkWorkerApiAccess
(
requestInfo
);
}
// if (!httpRequest.isSecure()) {
// throw new AppException(302, "Redirect", "HTTP is not supported. Use HTTPS.");
// }
filterChain
.
doFilter
(
servletRequest
,
servletResponse
);
HttpServletResponse
httpResponse
=
(
HttpServletResponse
)
servletResponse
;
...
...
provider/indexer-gcp/src/main/java/org/opengroup/osdu/indexer/persistence/ElasticRepositoryDatastore.java
View file @
e9168f53
...
...
@@ -20,16 +20,16 @@ import com.google.cloud.datastore.Entity;
import
com.google.cloud.datastore.Key
;
import
lombok.extern.java.Log
;
import
org.apache.http.HttpStatus
;
import
org.opengroup.osdu.core.common.model.http.AppException
;
import
org.opengroup.osdu.core.common.model.search.ClusterSettings
;
import
org.opengroup.osdu.core.common.model.tenant.TenantInfo
;
import
org.opengroup.osdu.core.common.model.http.AppException
;
import
org.opengroup.osdu.core.common.provider.interfaces.IKmsClient
;
import
org.opengroup.osdu.core.common.provider.interfaces.IElasticRepository
;
import
org.opengroup.osdu.core.common.provider.interfaces.IKmsClient
;
import
org.opengroup.osdu.core.common.search.Preconditions
;
import
org.opengroup.osdu.core.gcp.multitenancy.DatastoreFactory
;
import
org.opengroup.osdu.indexer.config.IndexerConfigurationProperties
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
javax.inject.Inject
;
@Log
...
...
provider/indexer-gcp/src/main/java/org/opengroup/osdu/indexer/publish/PublisherImpl.java
View file @
e9168f53
...
...
@@ -26,18 +26,16 @@ import com.google.pubsub.v1.PubsubMessage;
import
lombok.extern.java.Log
;
import
org.apache.http.HttpStatus
;
import
org.elasticsearch.common.Strings
;
import
org.opengroup.osdu.core.common.model.http.DpsHeaders
;
import
org.opengroup.osdu.core.common.provider.interfaces.ITenantFactory
;
import
org.opengroup.osdu.core.common.model.tenant.TenantInfo
;
import
org.opengroup.osdu.core.common.model.http.AppException
;
import
org.opengroup.osdu.core.common.model.http.DpsHeaders
;
import
org.opengroup.osdu.core.common.model.indexer.JobStatus
;
import
org.opengroup.osdu.core.common.model.indexer.RecordStatus
;
import
org.opengroup.osdu.core.common.model.search.DeploymentEnvironment
;
import
org.opengroup.osdu.core.common.model.tenant.TenantInfo
;
import
org.opengroup.osdu.core.common.provider.interfaces.ITenantFactory
;
import
org.opengroup.osdu.core.gcp.PubSub.PubSubExtensions
;
import
org.opengroup.osdu.indexer.config.IndexerConfigurationProperties
;
import
org.opengroup.osdu.indexer.provider.interfaces.IPublisher
;
import
org.opengroup.osdu.core.gcp.PubSub.PubSubExtensions
;
import
org.opengroup.osdu.core.common.model.search.DeploymentEnvironment
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.context.annotation.RequestScope
;
import
org.threeten.bp.Duration
;
...
...
provider/indexer-gcp/src/main/java/org/opengroup/osdu/indexer/security/GSuiteSecurityConfig.java
View file @
e9168f53
/*
Copyright 2020 Google LLC
Copyright 2020 EPAM Systems, Inc
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.indexer.security
;
import
org.springframework.context.annotation.Configuration
;
...
...
provider/indexer-gcp/src/main/java/org/opengroup/osdu/indexer/util/RequestInfoImpl.java
View file @
e9168f53
/*
Copyright 2020 Google LLC
Copyright 2020 EPAM Systems, Inc
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.indexer.util
;
import
com.google.api.client.googleapis.auth.oauth2.GoogleIdToken
;
...
...
@@ -50,7 +67,7 @@ public class RequestInfoImpl implements IRequestInfo {
@Value
(
"${indexer.que.service.mail}"
)
private
String
indexerQueServiceMail
;
private
static
final
String
expectedCronHeaderValue
=
"true"
;
private
static
final
String
EXPECTED_CRON_HEADER_VALUE
=
"true"
;
@Override
public
DpsHeaders
getHeaders
()
{
...
...
@@ -83,7 +100,7 @@ public class RequestInfoImpl implements IRequestInfo {
@Override
public
boolean
isCronRequest
()
{
String
appEngineCronHeader
=
this
.
dpsHeaders
.
getHeaders
().
getOrDefault
(
CloudTaskHeaders
.
CLOUD_CRON_SERVICE
,
null
);
return
expectedCronHeaderValue
.
equalsIgnoreCase
(
appEngineCronHeader
);
return
EXPECTED_CRON_HEADER_VALUE
.
equalsIgnoreCase
(
appEngineCronHeader
);
}
@Override
...
...
provider/indexer-gcp/src/main/java/org/opengroup/osdu/indexer/util/ServiceAccountJwtGcpClientImpl.java
View file @
e9168f53
...
...
@@ -38,16 +38,15 @@ import org.apache.http.impl.client.CloseableHttpClient;
import
org.apache.http.impl.client.HttpClients
;
import
org.apache.http.message.BasicNameValuePair
;
import
org.apache.http.util.EntityUtils
;
import
org.opengroup.osdu.core.common.model.http.DpsHeaders
;
import
org.opengroup.osdu.core.common.provider.interfaces.ITenantFactory
;
import
org.opengroup.osdu.core.common.model.tenant.TenantInfo
;
import
org.opengroup.osdu.core.common.logging.JaxRsDpsLog
;
import
org.opengroup.osdu.core.common.model.http.AppException
;
import
org.opengroup.osdu.core.common.model.http.DpsHeaders
;
import
org.opengroup.osdu.core.common.model.search.IdToken
;
import
org.opengroup.osdu.core.common.
logging.JaxRsDpsLog
;
import
org.opengroup.osdu.core.common.
model.tenant.TenantInfo
;
import
org.opengroup.osdu.core.common.provider.interfaces.IJwtCache
;
import
org.opengroup.osdu.core.common.provider.interfaces.ITenantFactory
;
import
org.opengroup.osdu.core.common.util.IServiceAccountJwtClient
;
import
org.opengroup.osdu.indexer.config.IndexerConfigurationProperties
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.context.annotation.RequestScope
;
...
...
@@ -64,7 +63,7 @@ public class ServiceAccountJwtGcpClientImpl implements IServiceAccountJwtClient
private
static
final
String
JWT_AUDIENCE
=
"https://www.googleapis.com/oauth2/v4/token"
;
private
static
final
String
SERVICE_ACCOUNT_NAME_FORMAT
=
"projects/%s/serviceAccounts/%s"
;
private
final
JsonFactory
JSON_FACTORY
=
new
JacksonFactory
();
private
final
JsonFactory
jsonFactory
=
new
JacksonFactory
();
private
Iam
iam
;
...
...
@@ -100,7 +99,7 @@ public class ServiceAccountJwtGcpClientImpl implements IServiceAccountJwtClient
Map
<
String
,
Object
>
signJwtPayload
=
this
.
getJWTCreationPayload
(
tenant
);
SignJwtRequest
signJwtRequest
=
new
SignJwtRequest
();
signJwtRequest
.
setPayload
(
JSON_FACTORY
.
toString
(
signJwtPayload
));
signJwtRequest
.
setPayload
(
jsonFactory
.
toString
(
signJwtPayload
));
String
serviceAccountName
=
String
.
format
(
SERVICE_ACCOUNT_NAME_FORMAT
,
tenant
.
getProjectId
(),
tenant
.
getServiceAccount
());
...
...
@@ -157,7 +156,7 @@ public class ServiceAccountJwtGcpClientImpl implements IServiceAccountJwtClient
}
// Create IAM API object associated with the authenticated transport.
this
.
iam
=
new
Iam
.
Builder
(
httpTransport
,
JSON_FACTORY
,
credential
)
this
.
iam
=
new
Iam
.
Builder
(
httpTransport
,
jsonFactory
,
credential
)
.
setApplicationName
(
properties
.
getIndexerHost
())
.
build
();
}
...
...
provider/indexer-gcp/src/test/java/org/opengroup/osdu/indexer/service/IndexerSchemaServiceTest.java
View file @
e9168f53
...
...
@@ -229,9 +229,9 @@ public class IndexerSchemaServiceTest {
try
{
this
.
sut
.
processSchemaMessages
(
schemaMessages
);
}
catch
(
AppException
e
)
{
assertEquals
(
e
.
getError
().
getCode
(),
RequestStatus
.
SCHEMA_CONFLICT
);
assertEquals
(
e
.
getError
().
getMessage
(),
"error creating or merging index mapping"
);
assertEquals
(
e
.
getError
().
getReason
()
,
reason
);
assertEquals
(
RequestStatus
.
SCHEMA_CONFLICT
,
e
.
getError
().
getCode
()
);
assertEquals
(
"error creating or merging index mapping"
,
e
.
getError
().
getMessage
()
);
assertEquals
(
reason
,
e
.
getError
().
getReason
());
}
catch
(
Exception
e
)
{
fail
(
"Should not throw this exception "
+
e
.
getMessage
());
}
...
...
@@ -262,9 +262,9 @@ public class IndexerSchemaServiceTest {
try
{
this
.
sut
.
processSchemaMessages
(
schemaMessages
);
}
catch
(
AppException
e
)
{
assertEquals
(
e
.
getError
().
getCode
(),
HttpStatus
.
SC_FORBIDDEN
);
assertEquals
(
e
.
getError
().
getMessage
()
,
"blah"
);
assertEquals
(
e
.
getError
().
getReason
()
,
reason
);
assertEquals
(
HttpStatus
.
SC_FORBIDDEN
,
e
.
getError
().
getCode
()
);
assertEquals
(
"blah"
,
e
.
getError
().
getMessage
());
assertEquals
(
reason
,
e
.
getError
().
getReason
());
}
catch
(
Exception
e
)
{
fail
(
"Should not throw this exception "
+
e
.
getMessage
());
}
...
...
@@ -358,9 +358,9 @@ public class IndexerSchemaServiceTest {
try
{
this
.
sut
.
syncIndexMappingWithStorageSchema
(
kind
);
}
catch
(
AppException
e
)
{
assertEquals
(
e
.
getError
().
getCode
(),
HttpStatus
.
SC_CONFLICT
);
assertEquals
(
e
.
getError
().
getMessage
()
,
"blah"
);