Skip to content

Commit 80813ba

Browse files
authored
Merge pull request #97 from odra/xamarin-support
Xamarin support
2 parents 1ff2178 + 6d69b86 commit 80813ba

File tree

8 files changed

+59
-16
lines changed

8 files changed

+59
-16
lines changed

integration/client_crudl_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ func TestClientJson(t *testing.T) {
4747
"cordova",
4848
"iOS",
4949
"android",
50+
"xamarin",
5051
}
5152

5253
name := fmt.Sprintf("%s-mobile-crud-test-entity", *prefix)

integration/getServicesTestData/json-output.golden

+8-3
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,15 @@
1919
"planUpdatable": false,
2020
"externalMetadata": {
2121
"dependencies": [
22-
"POSTGRES:95"
22+
"docker.io/aerogear/unifiedpush-wildfly:1.3.1.no-auth.Final",
23+
"docker.io/centos/postgresql-96-centos7:9.6",
24+
"docker.io/aerogear/ups-config-operator:master",
25+
"docker.io/openshift/oauth-proxy:v1.1.0"
2326
],
24-
"displayName": "AeroGear UPS",
27+
"displayName": "AeroGear Unified Push Server (UPS)",
2528
"documentationUrl": "https://aerogear.org/push",
2629
"imageUrl": "https://pbs.twimg.com/profile_images/1794440005/aerogear_icon-1_400x400.png",
30+
"longDescription": "An APB deploying the AeroGear UnifiedPush Server with persistent storage and authentication through Openshift",
2731
"providerDisplayName": "Red Hat, Inc.",
2832
"serviceName": "ups"
2933
},
@@ -147,7 +151,8 @@
147151
"planUpdatable": false,
148152
"externalMetadata": {
149153
"dependencies": [
150-
"Postgresql:9.5"
154+
"docker.io/jboss/keycloak-openshift:3.4.3.Final",
155+
"docker.io/centos/postgresql-96-centos7:9.6"
151156
],
152157
"displayName": "Keycloak",
153158
"documentationUrl": "http://www.keycloak.org/documentation.html",

integration/service_integration_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ func TestIntegration(t *testing.T) {
139139
func CreateInstance(t *testing.T, si *ProvisionServiceParams) {
140140
args := []string{"create", "serviceinstance", si.ServiceName, si.Namespace}
141141
args = append(args, si.Params...)
142-
t.Logf("executing: %v\n", *executable+strings.Join(args, " "))
142+
t.Logf("executing: %v\n", *executable+" "+strings.Join(args, " "))
143143
cmd := exec.Command(*executable, args...)
144144

145145
output, err := cmd.CombinedOutput()

pkg/cmd/clients.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,12 @@ Run the "mobile get clients" command from this tool to get the client ID.`,
126126
// CreateClientCmd builds the create mobileclient command
127127
func (cc *ClientCmd) CreateClientCmd() *cobra.Command {
128128
cmd := &cobra.Command{
129-
Use: "client <name> <clientType iOS|cordova|android> <appIdentifier bundleID|packageName>",
129+
Use: "client <name> <clientType iOS|cordova|android|xamarin> <appIdentifier bundleID|packageName>",
130130
Short: "create a mobile client representation in your namespace",
131131
Long: `create client sets up the representation of a mobile application of the specified type in your namespace.
132132
This is used to provide a mobile client context for various actions such as creating, starting or stopping mobile client builds.
133133
134-
The available client types are android, cordova and iOS.
134+
The available client types are android, cordova, iOS and xamarin.
135135
136136
When used standalone, a namespace must be specified by providing the --namespace flag.`,
137137
Example: ` mobile create client <name> <clientType> <appIdentifier> --namespace=myproject
@@ -172,6 +172,11 @@ When used standalone, a namespace must be specified by providing the --namespace
172172
case "cordova":
173173
app.Annotations["icon"] = "font-icon icon-cordova"
174174
break
175+
case "xamarin":
176+
app.Annotations["icon"] = "font-icon icon-xamarin"
177+
break
178+
default:
179+
return errors.New("Unknown client type")
175180
}
176181
app.Name = name + "-" + strings.ToLower(app.Spec.ClientType)
177182
if err := input.ValidateMobileClient(app); err != nil {

pkg/cmd/clients_test.go

+38-1
Original file line numberDiff line numberDiff line change
@@ -417,11 +417,48 @@ func TestMobileClientsCmd_TestCreateClient(t *testing.T) {
417417
}
418418
},
419419
},
420+
{
421+
Name: "test create xamarin mobile client succeeds without error",
422+
Args: []string{"test", "xamarin", "my.app.org"},
423+
MobileClient: func() mc.Interface {
424+
fkMc := &mcFake.Clientset{}
425+
fkMc.AddReactor("create", "mobileclients", func(action kt.Action) (handled bool, ret runtime.Object, err error) {
426+
ca := action.(kt.CreateAction)
427+
return true, ca.GetObject(), nil
428+
})
429+
return fkMc
430+
},
431+
Flags: []string{"--namespace=myproject", "-o=json"},
432+
Validate: func(t *testing.T, c *v1alpha1.MobileClient) {
433+
if nil == c {
434+
t.Fatal("expected a mobile client but got nil")
435+
}
436+
if c.Spec.ClientType != "xamarin" {
437+
t.Fatal("expected the clientType to be cordova but got ", c.Spec.ClientType)
438+
}
439+
if c.Spec.AppIdentifier != "my.app.org" {
440+
t.Fatal("expected an appIdentifier to be set as my.app.org but was ", c.Spec.AppIdentifier)
441+
}
442+
if c.Spec.Name != "test" {
443+
t.Fatal("expected the client name to be test but got ", c.Spec.Name)
444+
}
445+
if c.Spec.ApiKey == "" {
446+
t.Fatal("expected an apiKey to be generated but it was empty")
447+
}
448+
icon, ok := c.Annotations["icon"]
449+
if !ok {
450+
t.Fatal("expected an icon to be set but there was none")
451+
}
452+
if icon != "font-icon icon-xamarin" {
453+
t.Fatal("expected the icon to be icon-xamarin but got ", icon)
454+
}
455+
},
456+
},
420457
{
421458
Name: "test create mobile client fails with unknown client type",
422459
Args: []string{"test", "firefox", "my.app.org"},
423460
ExpectError: true,
424-
ErrorPattern: "^Failed validation while creating new mobile client: .*",
461+
ErrorPattern: "^Unknown client type",
425462
MobileClient: func() mc.Interface {
426463
fkMc := &mcFake.Clientset{}
427464
fkMc.AddReactor("create", "mobileclients", func(action kt.Action) (handled bool, ret runtime.Object, err error) {

pkg/cmd/input/validate.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ func (vc validClients) Contains(client string) bool {
4242
return false
4343
}
4444

45-
var ValidClients = validClients{"iOS", "android", "cordova"}
45+
var ValidClients = validClients{"iOS", "android", "cordova", "xamarin"}

vendor/github.com/mattn/go-runewidth/runewidth.go

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/mattn/go-runewidth/runewidth_test.go

+3-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)