@@ -91,6 +91,26 @@ function ValidateApplication {
9191 }
9292}
9393
94+ function ValidateBusinessEntity {
95+ [CmdletBinding ()]
96+
97+ PARAM (
98+ [parameter (Mandatory = $True ,
99+ Position = 0 ,
100+ ValueFromPipeline = $True ,
101+ HelpMessage = " Businesse entity to be verified" )][PSObject ]$BusinessEntity
102+ )
103+
104+ Process {
105+ $BusinessEntity.id | Should BeGreaterThan 0
106+ $BusinessEntity.self | Should Be " /rest/v1/assets/businessEntities/$ ( $BusinessEntity.id ) "
107+ $BusinessEntity.tenant | Should Match " .+"
108+ $BusinessEntity.lob | Should Match " .+"
109+ $BusinessEntity.businessUnit | Should Match " .+"
110+ $BusinessEntity.project | Should Match " .+"
111+ }
112+ }
113+
94114function ValidatePackage {
95115 [CmdletBinding ()]
96116
@@ -718,6 +738,77 @@ Describe "Datasource management" {
718738 }
719739}
720740
741+ Describe " Annotation management" {
742+
743+ BeforeEach {
744+ $OciServer = Connect-OciServer - Name $OciServerName - Credential $OciCredential - Insecure
745+ $null = Get-OciAnnotations | ? { $_.Name -eq " OciCmdletTest" } | Remove-OciAnnotation
746+ $OciServer = $null
747+ $Global :CurrentOciServer = $null
748+ $Annotation = $null
749+ }
750+
751+ Context " adding and removing annotations" {
752+ it " succeeds for type BOOLEAN" {
753+ $OciServer = Connect-OciServer - Name $OciServerName - Credential $OciCredential - Insecure
754+
755+ $Annotation = Add-OciAnnotation - Name " OciCmdletTest" - Type BOOLEAN
756+ $Annotation | ValidateAnnotation
757+ $Annotation | Remove-OciAnnotation
758+ }
759+
760+ it " succeeds for type DATE" {
761+ $OciServer = Connect-OciServer - Name $OciServerName - Credential $OciCredential - Insecure
762+
763+ $Annotation = Add-OciAnnotation - Name " OciCmdletTest" - Type DATE
764+ $Annotation | ValidateAnnotation
765+ $Annotation | Remove-OciAnnotation
766+ }
767+
768+ it " succeeds for type FIXED_ENUM" {
769+ $OciServer = Connect-OciServer - Name $OciServerName - Credential $OciCredential - Insecure
770+
771+ $Annotation = Add-OciAnnotation - Name " OciCmdletTest" - Type FIXED_ENUM - enumValues @ (@ {name = " key1" ;label = " label of key 1" }, @ {name = " key2" ;label = " label of key 2" })
772+ $Annotation | ValidateAnnotation
773+ $Annotation | Remove-OciAnnotation
774+ }
775+
776+ it " succeeds for type FLEXIBLE_ENUM" {
777+ $OciServer = Connect-OciServer - Name $OciServerName - Credential $OciCredential - Insecure
778+
779+ $Annotation = Add-OciAnnotation - Name " OciCmdletTest" - Type FLEXIBLE_ENUM - enumValues @ (@ {name = " key1" ;label = " label of key 1" }, @ {name = " key2" ;label = " label of key 2" })
780+ $Annotation | ValidateAnnotation
781+ $Annotation | Remove-OciAnnotation
782+ }
783+
784+ it " succeeds for type NUMBER" {
785+ $OciServer = Connect-OciServer - Name $OciServerName - Credential $OciCredential - Insecure
786+
787+ $Annotation = Add-OciAnnotation - Name " OciCmdletTest" - Type NUMBER
788+ $Annotation | ValidateAnnotation
789+ $Annotation | Remove-OciAnnotation
790+ }
791+
792+ it " succeeds with description" {
793+ $OciServer = Connect-OciServer - Name $OciServerName - Credential $OciCredential - Insecure
794+
795+ $Annotation = Add-OciAnnotation - Name " OciCmdletTest" - Type BOOLEAN - Description " description"
796+ $Annotation.description | Should Be " description"
797+ $Annotation | ValidateAnnotation
798+ $Annotation | Remove-OciAnnotation
799+ }
800+
801+ it " succeeds with transient OCI Server" {
802+ $OciServer = Connect-OciServer - Name $OciServerName - Credential $OciCredential - Insecure - Transient
803+ $CurrentOciServer | Should BeNullOrEmpty
804+
805+ $Annotation = Add-OciAnnotation - Name " OciCmdletTest" - Type BOOLEAN - Server $OciServer
806+ $Annotation | ValidateAnnotation
807+ $Annotation | Remove-OciAnnotation - Server $OciServer
808+ }
809+ }
810+ }
811+
721812Describe " Application management" {
722813
723814 BeforeEach {
@@ -866,73 +957,49 @@ Describe "Application management" {
866957 }
867958}
868959
869- Describe " Annotation management" {
960+ Describe " Business entity management" {
870961
871962 BeforeEach {
872963 $OciServer = Connect-OciServer - Name $OciServerName - Credential $OciCredential - Insecure
873964 $null = Get-OciAnnotations | ? { $_.Name -eq " OciCmdletTest" } | Remove-OciAnnotation
874965 $OciServer = $null
875966 $Global :CurrentOciServer = $null
876- $Annotation = $null
967+ $BusinessEntity = $null
877968 }
878969
879- Context " adding and removing annotations" {
880- it " succeeds for type BOOLEAN" {
881- $OciServer = Connect-OciServer - Name $OciServerName - Credential $OciCredential - Insecure
882-
883- $Annotation = Add-OciAnnotation - Name " OciCmdletTest" - Type BOOLEAN
884- $Annotation | ValidateAnnotation
885- $Annotation | Remove-OciAnnotation
886- }
887-
888- it " succeeds for type DATE" {
889- $OciServer = Connect-OciServer - Name $OciServerName - Credential $OciCredential - Insecure
890-
891- $Annotation = Add-OciAnnotation - Name " OciCmdletTest" - Type DATE
892- $Annotation | ValidateAnnotation
893- $Annotation | Remove-OciAnnotation
894- }
895-
896- it " succeeds for type FIXED_ENUM" {
970+ Context " adding and removing business entities" {
971+ it " succeeds with only tenant" {
897972 $OciServer = Connect-OciServer - Name $OciServerName - Credential $OciCredential - Insecure
898973
899- $Annotation = Add-OciAnnotation - Name " OciCmdletTest" - Type FIXED_ENUM - enumValues @ (@ {name = " key1" ;label = " label of key 1" }, @ {name = " key2" ;label = " label of key 2" })
900- $Annotation | ValidateAnnotation
901- $Annotation | Remove-OciAnnotation
974+ $Tenant = " OciCmdletTest"
975+ $BusinessEntity = Add-OciBusinessEntity - Tenant $Tenant
976+ $BusinessEntity | ValidateBusinessEntity
977+ $BusinessEntity.tenant | Should Be $Tenant
978+ $BusinessEntity | Remove-OciBusinessEntity
902979 }
903980
904- it " succeeds for type FLEXIBLE_ENUM " {
981+ it " succeeds with parameters tenant, LineOfBusiness, BusinessUnit and Project " {
905982 $OciServer = Connect-OciServer - Name $OciServerName - Credential $OciCredential - Insecure
906983
907- $Annotation = Add-OciAnnotation - Name " OciCmdletTest" - Type FLEXIBLE_ENUM - enumValues @ ( @ { name = " key1 " ; label = " label of key 1 " } , @ { name = " key2 " ; label = " label of key 2 " })
908- $Annotation | ValidateAnnotation
909- $Annotation | Remove-OciAnnotation
910- }
984+ $Tenant = " OciCmdletTest"
985+ $LineOfBusiness = " OciCmdletTest "
986+ $BusinessUnit = " OciCmdletTest "
987+ $Project = " OciCmdletTest "
911988
912- it " succeeds for type NUMBER" {
913- $OciServer = Connect-OciServer - Name $OciServerName - Credential $OciCredential - Insecure
914-
915- $Annotation = Add-OciAnnotation - Name " OciCmdletTest" - Type NUMBER
916- $Annotation | ValidateAnnotation
917- $Annotation | Remove-OciAnnotation
918- }
919-
920- it " succeeds with description" {
921- $OciServer = Connect-OciServer - Name $OciServerName - Credential $OciCredential - Insecure
922-
923- $Annotation = Add-OciAnnotation - Name " OciCmdletTest" - Type BOOLEAN - Description " description"
924- $Annotation.description | Should Be " description"
925- $Annotation | ValidateAnnotation
926- $Annotation | Remove-OciAnnotation
989+ $BusinessEntity = Add-OciBusinessEntity - Tenant $Tenant - LineOfBusiness $LineOfBusiness - BusinessUnit $BusinessUnit - Project $Project
990+ $BusinessEntity | ValidateBusinessEntity
991+ $BusinessEntity.tenant | Should Be $Tenant
992+ $BusinessEntity | Remove-OciBusinessEntity
927993 }
928994
929995 it " succeeds with transient OCI Server" {
930996 $OciServer = Connect-OciServer - Name $OciServerName - Credential $OciCredential - Insecure - Transient
931- $CurrentOciServer | Should BeNullOrEmpty
932997
933- $Annotation = Add-OciAnnotation - Name " OciCmdletTest" - Type BOOLEAN - Server $OciServer
934- $Annotation | ValidateAnnotation
935- $Annotation | Remove-OciAnnotation - Server $OciServer
998+ $Tenant = " OciCmdletTest"
999+ $BusinessEntity = Add-OciBusinessEntity - Tenant $Tenant - Server $OciServer
1000+ $BusinessEntity | ValidateBusinessEntity
1001+ $BusinessEntity.tenant | Should Be $Tenant
1002+ $BusinessEntity | Remove-OciBusinessEntity - Server $OciServer
9361003 }
9371004 }
9381005}
0 commit comments