-
Notifications
You must be signed in to change notification settings - Fork 1
/
application_test.go
92 lines (79 loc) · 2.89 KB
/
application_test.go
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package wserest
import (
"testing"
"github.com/openfresh/wse-rest-library-go/entity/application"
"github.com/openfresh/wse-rest-library-go/entity/application/helper"
)
func TestApplication(t *testing.T) {
// example setting up a stream configuration element
streamConfig := application.NewStreamConfig()
streamConfig.StreamType = "live"
streamConfig.LiveStreamPacketizer = []string{"sanjosestreamingpacketizer", "cupertinostreamingpacketizer"}
// example setting up a security configuration element
securityConfig := application.NewSecurityConfig()
securityConfig.SecureTokenVersion = 0
securityConfig.ClientStreamWriteAccess = "*"
securityConfig.PublishRequirePassword = true
securityConfig.PublishPasswordFile = ""
securityConfig.PublishRTMPSecureURL = ""
securityConfig.PublishIPBlackList = ""
securityConfig.PublishIPWhiteList = ""
securityConfig.PublishBlockDuplicateStreamNames = false
securityConfig.PublishValidEncoders = ""
securityConfig.PublishAuthenticationMethod = "digest"
securityConfig.PlayMaximumConnections = 0
securityConfig.PlayRequireSecureConnection = false
securityConfig.SecureTokenSharedSecret = ""
securityConfig.SecureTokenUseTEAForRTMP = false
securityConfig.SecureTokenIncludeClientIPInHash = false
securityConfig.SecureTokenHashAlgorithm = ""
securityConfig.SecureTokenQueryParametersPrefix = ""
securityConfig.SecureTokenOriginSharedSecret = ""
securityConfig.PlayIPBlackList = ""
securityConfig.PlayIPWhiteList = ""
securityConfig.PlayAuthenticationMethod = "none"
// example setting up module(s) configuration element
modules := application.NewModules()
modules.ModuleList = append(modules.ModuleList, modules.GetModuleItem("ModuleCoreSecurity", "ModuleCoreSecurity", "com.wowza.wms.security.ModuleCoreSecurity", -1))
// Create settings
settings := helper.NewDefaultSettings()
settings.SetHost(WowzaHost)
settings.SetUseDigest(true)
settings.SetUsername(WowzaUsername)
settings.SetPassword(WowzaPassword)
// Create this application
wowzaApplication := NewApplication(settings, "live", "", "", "", "")
if UseWowza == "" {
return
}
response, err := wowzaApplication.GetAll()
if err != nil {
t.Fatal(err)
}
t.Log(response)
response, err = wowzaApplication.Get()
if err != nil {
t.Fatal(err)
}
t.Log(response)
wowzaApplication2 := NewApplication(settings, "live2", "", "", "", "")
response, err = wowzaApplication2.Create(streamConfig, nil, nil, nil, nil, nil)
if err != nil {
t.Fatal(err)
}
defer wowzaApplication2.Remove()
t.Log(response)
wowzaApplication3 := NewApplication(settings, "live3", "", "", "", "")
response, err = wowzaApplication3.Create(streamConfig, securityConfig, modules, nil, nil, nil)
if err != nil {
t.Fatal(err)
}
defer wowzaApplication3.Remove()
t.Log(response)
// Update the application
response, err = wowzaApplication3.Update(streamConfig, nil, nil, nil, nil, nil)
if err != nil {
t.Fatal(err)
}
t.Log(response)
}