Skip to content

Commit

Permalink
Merge pull request #266 from Sunbird-RC/release-1.0.0
Browse files Browse the repository at this point in the history
Release 1.0.0
  • Loading branch information
srprasanna authored Nov 10, 2023
2 parents 6e4958c + 8a10773 commit f34c790
Show file tree
Hide file tree
Showing 81 changed files with 4,672 additions and 454 deletions.
4 changes: 2 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ node {


stage('Push image') {
docker.withRegistry('', 'dockerhub') {
docker.withRegistry('ghcr.io', 'sunbird-rc') {
app.push("${env.BUILD_NUMBER}")
app.push("latest")
}
docker.withRegistry('', 'dockerhub') {
docker.withRegistry('ghrc.io', 'sunbird-rc') {
claimApp.push("${env.BUILD_NUMBER}")
claimApp.push("latest")
}
Expand Down
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,19 @@ test: build
@cd java/apitest && MODE=async ../mvnw -Pe2e test
@docker-compose down
@rm -rf db-data-2 || echo "no permission to delete"
# test with fusionauth
@docker-compose --env-file test_environments/test_with_fusionauth.env -f docker-compose.yml -f services/sample-fusionauth-service/docker-compose.yml up -d db es fusionauth fusionauthwrapper
sleep 20
@echo "Starting the test" && sh build/wait_for_port.sh 9011
@echo "Starting the test" && sh build/wait_for_port.sh 3990
sleep 20
@docker-compose --env-file test_environments/test_with_fusionauth.env -f docker-compose.yml -f services/sample-fusionauth-service/docker-compose.yml up -d --no-deps registry
@echo "Starting the test" && sh build/wait_for_port.sh 8081
@docker-compose -f docker-compose.yml -f services/sample-fusionauth-service/docker-compose.yml ps
@curl -v http://localhost:8081/health
@cd java/apitest && MODE=fusionauth ../mvnw -Pe2e test || echo 'Tests failed'
@docker-compose -f docker-compose.yml -f services/sample-fusionauth-service/docker-compose.yml down
@rm -rf db-data-3 || echo "no permission to delete"
make -C services/certificate-signer test
make -C services/public-key-service test
make -C services/context-proxy-service test
Expand Down
7 changes: 6 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ services:
- elastic_search_password=${ELASTIC_SEARCH_PASSWORD}
- search_providerName=${SEARCH_PROVIDER_NAME-dev.sunbirdrc.registry.service.NativeSearchService}
- sunbird_sso_realm=${KEYCLOAK_REALM-sunbird-rc}
- sunbird_sso_url=http://keycloak:8080/auth
- sunbird_sso_url=${sunbird_sso_url-http://keycloak:8080/auth}
- oauth2_resource_uri=${oauth2_resource_uri-http://keycloak:8080/auth/realms/sunbird-rc}
- oauth2_resource_roles_path=${oauth2_resource_roles_path-realm_access.roles}
- identity_provider=${identity_provider-dev.sunbirdrc.auth.keycloak.KeycloakProviderImpl}
- sunbird_sso_admin_client_id=${KEYCLOAK_ADMIN_CLIENT_ID-admin-api}
- sunbird_sso_client_id=${KEYCLOAK_CLIENT_ID-registry-frontend}
- sunbird_sso_admin_client_secret=${KEYCLOAK_SECRET}
Expand Down Expand Up @@ -99,6 +102,8 @@ services:
depends_on:
db:
condition: service_healthy
keycloak:
condition: service_healthy
healthcheck:
test:
[
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"userDetails": {
"passkey": "abcd"
"passkey": "abcd@12345"
},
"contactDetails": {
"mobile": "9876543210",
"email": "[email protected]"
}
}
}
3 changes: 3 additions & 0 deletions java/apitest/src/test/java/e2e/registry/certificate.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ Feature: Get certificate pdf
Background:
* def certUrl = "http://localhost:8078"
* def templateBody = {"certificate": "{\"name\":\"Test Name\", \"dob\":\"2002-12-22\"}","templateUrl": "http://registry:8081/api/v1/templates/Student.html"}

@envnot=fusionauth
Scenario:
And header Accept = 'application/pdf'
Given url certUrl
Expand All @@ -11,6 +13,7 @@ Feature: Get certificate pdf
Then status 200
#* print response

@envnot=fusionauth
Scenario:
And header Accept = 'application/pdf'
Given url certUrl
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
Feature: Registry api tests
Background:
* string registryUrl = "http://localhost:8081"
* string authUrl = "http://localhost:9011"
* url registryUrl
* def admin_token = ""
* def client_secret = 'a52c5f4a-89fd-40b9-aea2-3f711f14c889'
* def sleep = function(millis){ java.lang.Thread.sleep(millis) }
@env=fusionauth
Scenario: Create student with password schema and verify if password is set
# get admin token
* url authUrl
* path '/oauth2/token'
* header Content-Type = 'application/x-www-form-urlencoded; charset=utf-8'
* header Host = 'fusionauth:9011'
* form field grant_type = 'password'
* form field client_id = '85a03867-dccf-4882-adde-1a79aeec50df'
* form field username = '[email protected]'
* form field password = 'admin@12345'
* method post
Then status 200
And print response.access_token
* def admin_token = 'Bearer ' + response.access_token
# create student schema
Given url registryUrl
And path 'api/v1/Schema'
And header Authorization = admin_token
And request read('StudentWithPasswordSchemaRequest.json')
When method post
Then status 200
And response.params.status == "SUCCESSFUL"
# invite entity for student
Given url registryUrl
And path 'api/v1/StudentWithPassword/invite'
* def studentRequest = read('StudentWithPasswordRequest.json')
And request studentRequest
When method post
Then status 200
* def studentOsid = response.result.StudentWithPassword.osid
# get student token
* url authUrl
* path '/oauth2/token'
* header Content-Type = 'application/x-www-form-urlencoded; charset=utf-8'
* header Host = 'fusionauth:9011'
* form field grant_type = 'password'
* form field client_id = '85a03867-dccf-4882-adde-1a79aeec50df'
* form field username = studentRequest.contactDetails.mobile
* form field password = studentRequest.userDetails.passkey
* method post
Then status 200
And print response.access_token
* def student_token = 'Bearer ' + response.access_token
* sleep(3000)
# get student info
Given url registryUrl
And path 'api/v1/StudentWithPassword/'
And header Authorization = student_token
When method get
Then status 200
And response[0].osid.length > 0
12 changes: 9 additions & 3 deletions java/apitest/src/test/java/e2e/registry/registry.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ Feature: Registry api tests
* def admin_token = ""
* def client_secret = 'a52c5f4a-89fd-40b9-aea2-3f711f14c889'
* def sleep = function(millis){ java.lang.Thread.sleep(millis) }

@envnot=fusionauth
Scenario: health check
Given path 'health'
When method get
Then status 200

@envnot=fusionauth
Scenario: Create birth certificate schema and issue credentials
# get admin token
* url authUrl
Expand Down Expand Up @@ -102,7 +102,7 @@ Feature: Registry api tests
And response.params.status == "UNSUCCESSFUL"
And response.params.errmsg == "entity status is inactive"


@envnot=fusionauth
Scenario: Create student schema and verify crud apis
# get admin token
* url authUrl
Expand Down Expand Up @@ -234,6 +234,7 @@ Feature: Registry api tests
And response.length == 1
And response[0].contact == '#notpresent'

@envnot=fusionauth
Scenario: Create Board and invite institutes
# get admin token
* url authUrl
Expand Down Expand Up @@ -347,6 +348,7 @@ Feature: Registry api tests
And assert response[0].address[0].phoneNo.length == 1
And assert response[0].address[0].phoneNo[0] == "444"

@envnot=fusionauth
Scenario: write a api test, to test the schema not found error
# get admin token
* url authUrl
Expand Down Expand Up @@ -486,6 +488,7 @@ Feature: Registry api tests
And response.params.status =="UNSUCCESSFUL"
And response.params.errmsg == "Schema 'Teacher1' not found"

@envnot=fusionauth
Scenario: Create student with password schema and verify if password is set
# get admin token
* url authUrl
Expand Down Expand Up @@ -544,6 +547,8 @@ Feature: Registry api tests
When method get
Then status 200
* match response.contactDetails == { mobile: '#notpresent', email: '#present', osid: '#present' }

@envnot=fusionauth
Scenario: Create birth certificate schema, issue credentials then revoke the credential and check for CRUD APIS
# get admin token
* url authUrl
Expand Down Expand Up @@ -678,6 +683,7 @@ Feature: Registry api tests
And print response[notificationStudent]
And assert response[notificationStudent] != null

@envnot=fusionauth
Scenario: Test unique constraints with nested and composite fields
# create entity
Given url registryUrl
Expand Down
4 changes: 3 additions & 1 deletion java/middleware/pom.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
<?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>

Expand Down
76 changes: 76 additions & 0 deletions java/middleware/registry-middleware/auth0/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?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">
<parent>
<artifactId>registry-middleware</artifactId>
<groupId>dev.sunbirdrc</groupId>
<version>2.0.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>auth0</artifactId>

<dependencyManagement>
<dependencies>

</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>auth0</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.0.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.0.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.32</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>5.3.9</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>dev.sunbirdrc</groupId>
<artifactId>pojos</artifactId>
<version>2.0.3</version>
</dependency>
<dependency>
<groupId>dev.sunbirdrc</groupId>
<artifactId>middleware-commons</artifactId>
<version>2.0.3</version>
</dependency>
<dependency>
<groupId>dev.sunbirdrc</groupId>
<artifactId>identity-provider</artifactId>
<version>2.0.3</version>
</dependency>

</dependencies>
</project>
Loading

0 comments on commit f34c790

Please sign in to comment.