summaryrefslogtreecommitdiffstats
path: root/auth/sample/data/identities.dat
blob: cf3d67108a5877104971e0493f292e6f0709d679 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#
# Sample Identities.dat
# This file is for use with the "Default Organization". It is a simple mechanism to have a basic ILM structure to use with
# out-of-the-box tire-kicking, or even for Small companies
#
# For Larger Companies, you will want to create a new class implementing the "Organization" interface, making calls to your ILM, or utilizing
# batch feeds, as is appropriate for your company.
#
# Example Field Layout.  note, in this example, Application IDs and People IDs are mixed.  You may want to split
# out AppIDs, choose your own status indicators, or whatever you use.
#  0 - unique ID
#  1 - full name
#  2 - first name
#  3 - last name
#  4 - phone
#  5 - official email
#  6 - employment status e=employee, c=contractor, a=application, n=no longer with company
#  7 - responsible to (i.e Supervisor for People, or AppOwner, if it's an App ID)
#

iowna|Ima D. Owner|Ima|Owner|314-123-2000|ima.d.owner@people.osaaf.com|e|
mmanager|Mark D. Manager|Mark|Manager|314-123-1234|mark.d.manager@people.osaaf.com|e|iowna
bdevl|Robert D. Developer|Bob|Developer|314-123-1235|bob.d.developer@people.osaaf.com|e|mmanager
mmarket|Mary D. Marketer|Mary|Marketer|314-123-1236|mary.d.marketer@people.osaaf.com|e|mmanager
ccontra|Clarice D. Contractor|Clarice|Contractor|314-123-1237|clarice.d.contractor@people.osaaf.com|c|mmanager
iretired|Ira Lee M. Retired|Ira|Retired|314-123-1238|clarice.d.contractor@people.osaaf.com|n|mmanager

# ONAP default Users
demo|PORTAL DEMO|PORTAL|DEMO|||e|aaf_admin
jh0003|PORTAL ADMIN|PORTAL|ADMIN|||e|aaf_admin
cs0008|PORTAL DESIGNER|PORTAL|DESIGNER|||e|aaf_admin
jm0007|PORTAL TESTER|PORTAL|TESTER|||e|aaf_admin
op0001|PORTAL OPS|PORTAL|OPS|||e|aaf_admin
gv0001|PORTAL GOVERNOR|PORTAL|GOVERNOR|||e|aaf_admin

# AAF Defined Users
aaf_admin|AAF Administrator|Mr AAF|AAF Admin|||e|mmanager
deploy|Deployer|Deployer|Depoyer|||e|aaf_admin

# Requested Users
djtimoney|Dan Timoney|Dan|Timoney|||e|mmanager
portal_admin|Portal Admin|Portal|Admin|||e|mmanager

# ONAP App IDs
aaf|AAF Application|AAF|Application|||a|aaf_admin
aaf-sms|AAF SMS Application|AAF SMS|Application|||a|aaf_admin
clamp|ONAP CLAMP Application|CLAMP|Application|||a|aaf_admin
aai|ONAP AAI Application|AAI|ONAP Application|||a|aaf_admin
appc|ONAP APPC Application|APPC|ONAP Application|||a|aaf_admin
dcae|ONAP DCAE Application|CLAMP|ONAP Application|||a|aaf_admin
oof|ONAP OOF Application|OOF|ONAP Application|||a|aaf_admin
so|ONAP SO Application|SO|ONAP Application|||a|aaf_admin
sdc|ONAP SDC Application|SDC|ONAP Application|||a|aaf_admin
sdnc|ONAP SDNC Application|SDNC|ONAP Application|||a|aaf_admin
vid|ONAP VID Application|VID|ONAP Application|||a|aaf_admin
policy|ONAP Policy Application|POLICY|ONAP Application|||a|aaf_admin
portal|ONAP Portal Application|PORTAL|ONAP Application|||a|aaf_admin

# DMAAP Identities
dmaap-bc|ONAP DMaap BC Application|DMaap BC|ONAP Application|||a|aaf_admin
dmaap_bc_topic_mgr|ONAP DMaap BC Topic Manager|DMaap BC Topic Manager|DMaap BC|||a|aaf_admin
dmaap_bc_mm_prov|ONAP DMaap BC Provisioning Manager|DMaap BC Provision Manager|DMaap BC|||a|aaf_admin
dmaap-mr|ONAP DMaap MR Application|DMaap MR|ONAP Application|||a|aaf_admin
dmaap-dr-prov|ONAP DMaap DR Prov|Prov|DMaap MR|||a|aaf_admin
dmaap-dr-node|ONAP DMaap DR Node|Node|DMaap MR|||a|aaf_admin
Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
/*
 * Copyright © 2019 Bell Canada.
 *
 * 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.onap.ccsdk.cds.blueprintsprocessor.configs.api

import kotlinx.coroutines.runBlocking
import org.junit.Test
import org.junit.runner.RunWith
import org.onap.ccsdk.cds.blueprintsprocessor.core.BluePrintCoreConfiguration
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BluePrintCatalogService
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest
import org.springframework.context.annotation.ComponentScan
import org.springframework.http.MediaType
import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
import org.springframework.test.web.reactive.server.WebTestClient
import org.springframework.web.reactive.function.BodyInserters

@RunWith(SpringRunner::class)
@WebFluxTest
@ContextConfiguration(
    classes = [BluePrintCoreConfiguration::class, BluePrintCatalogService::class]
)
@ComponentScan(basePackages = ["org.onap.ccsdk.cds.blueprintsprocessor", "org.onap.ccsdk.cds.controllerblueprints"])
@TestPropertySource(locations = ["classpath:application-test.properties"])
class ResourceConfigSnapshotControllerTest {

    private val log = LoggerFactory.getLogger(ResourceConfigSnapshotControllerTest::class.toString())

    @Autowired
    lateinit var webTestClient: WebTestClient

    val resourceId = "fcaa6ac3ff08"
    val resourceType = "PNF"
    val snapshotData = "PAYLOAD DATA"

    var requestArguments = "resourceId=$resourceId&resourceType=$resourceType"

    @Test
    fun `ping return Success`() {
        runBlocking {
            webTestClient.get().uri("/api/v1/configs/health-check")
                .exchange()
                .expectStatus().isOk
                .expectBody()
                .equals("Success")
        }
    }

    @Test
    fun `update configuration is allowed and updates timestamp`() {
        runBlocking {

            webTestClient
                .post()
                .uri("/api/v1/configs/$resourceType/$resourceId/running")
                .body(BodyInserters.fromObject(snapshotData))
                .exchange()
                .expectStatus().is2xxSuccessful
                .expectBody()
                .jsonPath("$.createdDate")
                .value<String> { println(it) }

            webTestClient
                .post()
                .uri("/api/v1/configs/$resourceType/$resourceId/running")
                .body(BodyInserters.fromObject(snapshotData))
                .exchange()
                .expectStatus().is2xxSuccessful
                .expectBody()
                .jsonPath("$.createdDate")
                .value<String> { println(it) }
        }
    }

    @Test
    fun `get returns requested JSON content-type`() {
        runBlocking {
            post(resourceType, "22", "RUNNING")
            get("json", resourceType, "22", "RUNNING")
        }
    }

    @Test
    fun `get returns requested XML content-type`() {
        runBlocking {
            post(resourceType, "3", "CANDIDATE")
            get("xml", resourceType, "3", "CANDIDATE")
        }
    }

    @Test
    fun `get returns 400 error if missing arg`() {
        runBlocking {
            val arguments = "artifactName=WRONGARG1&resolutionKey=WRONGARG1"

            webTestClient.get().uri("/api/v1/configs?$arguments")
                .exchange()
                .expectStatus().isBadRequest
        }
    }

    @Test
    fun `get returns 400 error if wrong Status arg`() {
        runBlocking {
            val arguments = "resourceId=MISSING&resourceType=PNF&status=TOTALLY_WRONG"

            webTestClient.get().uri("/api/v1/configs?$arguments")
                .exchange()
                .expectStatus().isBadRequest
        }
    }

    @Test
    fun `get returns 200 if entry not found`() {
        runBlocking {

            webTestClient
                .get()
                .uri("/api/v1/configs?resourceId=MISSING&resourceType=PNF")
                .exchange()
                .expectStatus().is2xxSuccessful
                .expectBody()
        }
    }

    private fun post(resourceType: String, resourceId: String, status: String) {
        webTestClient
            .post()
            .uri("/api/v1/configs/$resourceType/$resourceId/$status")
            .body(BodyInserters.fromObject(snapshotData))
            .exchange()
            .expectStatus().is2xxSuccessful
            .expectBody()
    }

    private fun get(expectedType: String, resourceType: String, resourceId: String, status: String) {
        var requestArguments = "resourceId=$resourceId&resourceType=$resourceType&status=$status"

        if (expectedType.isNotEmpty()) {
            requestArguments = "$requestArguments&format=$expectedType"
            webTestClient
                .get()
                .uri("/api/v1/configs?$requestArguments")
                .exchange()
                .expectStatus().is2xxSuccessful
                .expectHeader().contentType(MediaType.valueOf("application/$expectedType"))
                .expectBody().equals(snapshotData)
        } else {
            webTestClient
                .get()
                .uri("/api/v1/configs?$requestArguments")
                .exchange()
                .expectStatus().is2xxSuccessful
                .expectHeader().contentType(MediaType.TEXT_PLAIN)
                .expectBody().equals(snapshotData)
        }
    }
}