Skip to content

Commit

Permalink
Merge pull request #15 from SylvainGuilbaud/few-things
Browse files Browse the repository at this point in the history
create 2 databases to separate DATA and CODE
  • Loading branch information
evshvarov authored Aug 17, 2023
2 parents b0a03af + b67edaa commit 979dc52
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"iris.script": "objectscript"
},
"objectscript.conn" :{
"active": false,
"active": true,
"ns": "IRISAPP",
"username": "_SYSTEM",
"password": "SYS",
Expand Down
8 changes: 5 additions & 3 deletions Installer.cls → App.Installer.cls
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ XData setup
<Default Name="Namespace" Value="IRISAPP"/>
<Default Name="database" Value="irisapp"/>

<Namespace Name="${Namespace}" Code="${Namespace}" Data="${Namespace}" Create="yes" Ensemble="no">

<Namespace Name="${Namespace}" Code="${Namespace}-CODE" Data="${Namespace}-DATA" Create="yes" Ensemble="1">
<Configuration>
<Database Name="${Namespace}" Dir="${mgrdir}${database}/data" Create="yes" Resource="%DB_${Namespace}"/>
<Database Name="${Namespace}-DATA" Dir="${mgrdir}${database}/data" Create="yes" Resource="%DB_${Namespace}-DATA"/>
<Database Name="${Namespace}-CODE" Dir="${mgrdir}${database}/code" Create="yes" Resource="%DB_${Namespace}-CODE"/>
</Configuration>
<CSPApplication Url="/csp/${app}" Directory="${cspdir}${app}" ServeFiles="1" Recurse="1" MatchRoles=":%DB_${Namespace}" AuthenticationMethods="32"
/>
</Namespace>
</Manifest>
}
Expand Down
71 changes: 37 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,50 +116,53 @@ IRISAPP>zpm
|| Welcome to the Package Manager Shell (ZPM). ||
|| Enter q/quit to exit the shell. Enter ?/help to view available commands ||
=============================================================================
zpm:IRISAPP>load /irisrun/repo
[dc-sample-template] Reload START (/irisrun/repo/)
[dc-sample-template] Reload SUCCESS
[dc-sample-template] Module object refreshed.
[dc-sample-template] Validate START
[dc-sample-template] Validate SUCCESS
[dc-sample-template] Compile START
[dc-sample-template] Compile SUCCESS
[dc-sample-template] Activate START
[dc-sample-template] Configure START
[dc-sample-template] Configure SUCCESS
[dc-sample-template] MakeDeployed START
[dc-sample-template] MakeDeployed SUCCESS
[dc-sample-template] Activate SUCCESS
zpm:IRISAPP>test dc-sample-template
[dc-sample-template] Reload START (/irisrun/repo/)
[dc-sample-template] Reload SUCCESS
[dc-sample-template] Module object refreshed.
[dc-sample-template] Validate START
[dc-sample-template] Validate SUCCESS
[dc-sample-template] Compile START
[dc-sample-template] Compile SUCCESS
[dc-sample-template] Activate START
[dc-sample-template] Configure START
[dc-sample-template] Configure SUCCESS
[dc-sample-template] MakeDeployed START
[dc-sample-template] MakeDeployed SUCCESS
[dc-sample-template] Activate SUCCESS
[dc-sample-template] Test STARTIt works!
zpm:IRISAPP>load /home/irisowner/dev
[IRISAPP|dc-sample] Reload START (/home/irisowner/dev/)
[IRISAPP|dc-sample] requirements.txt START
[IRISAPP|dc-sample] requirements.txt SUCCESS
[IRISAPP|dc-sample] Reload SUCCESS
[dc-sample] Module object refreshed.
[IRISAPP|dc-sample] Validate START
[IRISAPP|dc-sample] Validate SUCCESS
[IRISAPP|dc-sample] Compile START
[IRISAPP|dc-sample] Compile SUCCESS
[IRISAPP|dc-sample] Activate START
[IRISAPP|dc-sample] Configure START
[IRISAPP|dc-sample] Configure SUCCESS
[IRISAPP|dc-sample] Activate SUCCESS
zpm:IRISAPP>test dc-sample
[IRISAPP|dc-sample] Reload START (/home/irisowner/dev/)
[IRISAPP|dc-sample] Reload SUCCESS
[dc-sample] Module object refreshed.
[IRISAPP|dc-sample] Validate START
[IRISAPP|dc-sample] Validate SUCCESS
[IRISAPP|dc-sample] Compile START
[IRISAPP|dc-sample] Compile SUCCESS
[IRISAPP|dc-sample] Activate START
[IRISAPP|dc-sample] Configure START
[IRISAPP|dc-sample] Configure SUCCESS
[IRISAPP|dc-sample] Activate SUCCESS
[IRISAPP|dc-sample] Test STARTHello World!
This is InterSystems IRIS with version IRIS for UNIX (Ubuntu Server LTS for ARM64 Containers) 2023.2 (Build 221U) Fri Jul 21 2023 15:12:42 EDT
Current time is: 16 Aug 2023 14:32:10
Use the following URL to view the result:
http://172.28.0.2:52773/csp/sys/%25UnitTest.Portal.Indices.cls?Index=1&$NAMESPACE=IRISAPP
http://172.31.0.2:52773/csp/sys/%25UnitTest.Portal.Indices.cls?Index=2&$NAMESPACE=IRISAPP
All PASSED
[dc-sample-template] Test SUCCESS
[IRISAPP|dc-sample] Test SUCCESS
zpm:IRISAPP>
```

In case of test errors, you can find more details back in the UnitTest portal, which can be easily opened via ObjectScript menu in VSCode:

![vscvode unittest](https://user-images.githubusercontent.com/2781759/152678943-7d9d9696-e26a-449f-b1d7-f924528c8e3a.png)

If you have installed the [_InterSystems Testing Manager for VS Code_ extension](https://openexchange.intersystems.com/package/InterSystems-Testing-Manager-for-VS-Code)
you can also run unit tests directly from VSCode :
![vscvode unittest](https://raw.githubusercontent.com/intersystems-community/intersystems-testingmanager/main/images/README/Overview-Client.gif)

## What else is inside the repository

### .github folder
Expand Down
2 changes: 1 addition & 1 deletion iris.script
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
do ##class(Security.Services).Modify("%Service_CallIn",.prop)

// create IRISAPP namespace
do $SYSTEM.OBJ.Load("/home/irisowner/dev/Installer.cls", "ck")
do $SYSTEM.OBJ.Load("/home/irisowner/dev/App.Installer.cls", "ck")
set sc = ##class(App.Installer).setup()

zn "IRISAPP"
Expand Down
35 changes: 33 additions & 2 deletions src/dc/sample/ObjectScript.cls
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,43 @@ Class dc.sample.ObjectScript
{

ClassMethod Test() As %Status
{
set sc = $$$OK
Try {
set sc = ..Run() ; Python
set sc = ..Run(0) ; ObjectScript
}
Catch ex {
set sc=ex.AsStatus()
}
return sc
}

ClassMethod Run(python As %Boolean = 1) As %Status
{
return:python ..Python()
return:'python ..ObjectScript()
}

ClassMethod ObjectScript() As %Status
{
set a=42
write "Hello World!",!
write "Hello World! from ",$CLASSMETHOD("dc.sample.ObjectScript","%ClassName",1)," in ObjectScript language",!
write "This is InterSystems IRIS with version ",$zv,!
write "Current time is: "_$zdt($h,2)
write "Current time is: "_$zdt($now(),2,,6),!
return a
}

ClassMethod Python() As %Status [ Language = python ]
{
import iris
from datetime import datetime
a=42
print("Hello World! from",iris.cls('dc.sample.ObjectScript')._ClassName(1),"in Python language")
print("This is InterSystems IRIS with version",iris.cls('%SYSTEM.Version').GetVersion())
now = datetime.now()
print("Current time is:",now)
return a
}

}

0 comments on commit 979dc52

Please sign in to comment.