[1/2] brooklyn-server git commit: Improve JcloudsWinrmingLiveTest coverage
Repository: brooklyn-server Updated Branches: refs/heads/master cd2652459 -> 12e6b0045 Improve JcloudsWinrmingLiveTest coverage - add Azure ARM - improve error message for DefaultConnectivityResolver Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/639e3d80 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/639e3d80 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/639e3d80 Branch: refs/heads/master Commit: 639e3d809b850879db29f6dd532f5653f22df62f Parents: cd26524 Author: andreaturliAuthored: Wed Feb 21 12:10:32 2018 +0100 Committer: andreaturli Committed: Mon Feb 26 20:42:12 2018 +0100 -- .../jclouds/DefaultConnectivityResolver.java| 40 .../jclouds/AbstractJcloudsLiveTest.java| 5 ++- .../jclouds/JcloudsWinrmingLiveTest.java| 19 ++ 3 files changed, 47 insertions(+), 17 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/639e3d80/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/DefaultConnectivityResolver.java -- diff --git a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/DefaultConnectivityResolver.java b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/DefaultConnectivityResolver.java index d58660a..9434a22 100644 --- a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/DefaultConnectivityResolver.java +++ b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/DefaultConnectivityResolver.java @@ -19,11 +19,14 @@ package org.apache.brooklyn.location.jclouds; +import java.util.Collections; import java.util.Iterator; import java.util.Map; import javax.annotation.Nullable; +import com.google.common.base.Predicates; +import com.google.common.collect.Lists; import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.api.entity.EntityInitializer; import org.apache.brooklyn.api.entity.EntityLocal; @@ -181,24 +184,27 @@ public class DefaultConnectivityResolver extends BasicConfigurableObject impleme LoginCredentials credChoice = null; final Iterable managementCandidates = getManagementCandidates(location, node, config, options); -final Iterable credentialCandidates = getCredentialCandidates(location, node, options, config); - -// Try each pair of address and credential until one succeeds. -if (shouldCheckCredentials() && options.pollForReachableAddresses()) { -for (HostAndPort hap : managementCandidates) { -for (LoginCredentials cred : credentialCandidates) { -LOG.trace("Testing host={} with credential={}", hap, cred); -if (checkCredential(location, hap, cred, config, options.isWindows())) { -hapChoice = hap; -credChoice = cred; -break; +Iterable credentialCandidates = Collections.emptyList(); +if (!Iterables.isEmpty(managementCandidates)) { +credentialCandidates = getCredentialCandidates(location, node, options, config); + +// Try each pair of address and credential until one succeeds. +if (shouldCheckCredentials() && options.pollForReachableAddresses()) { +for (HostAndPort hap : managementCandidates) { +for (LoginCredentials cred : credentialCandidates) { +LOG.trace("Testing host={} with credential={}", hap, cred); +if (checkCredential(location, hap, cred, config, options.isWindows())) { +hapChoice = hap; +credChoice = cred; +break; +} } +if (hapChoice != null) break; } -if (hapChoice != null) break; +} else if (shouldCheckCredentials()) { +LOG.debug("{} set on {} but pollForFirstReachableAddress={}", +new Object[]{CHECK_CREDENTIALS.getName(), this, options.pollForReachableAddresses()}); } -} else if (shouldCheckCredentials()) { -LOG.debug("{} set on {} but pollForFirstReachableAddress={}", -new Object[]{CHECK_CREDENTIALS.getName(), this, options.pollForReachableAddresses()}); } if (hapChoice == null) { @@ -212,8 +218,10 @@ public class DefaultConnectivityResolver extends BasicConfigurableObject impleme } if (hapChoice == null) { -throw new IllegalStateException("jclouds
[2/2] brooklyn-server git commit: This closes #949
This closes #949 Improve JcloudsWinrmingLiveTest coverage Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/12e6b004 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/12e6b004 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/12e6b004 Branch: refs/heads/master Commit: 12e6b0045c05c5a56b2efa078171c69669b1 Parents: cd26524 639e3d8 Author: Sam CorbettAuthored: Wed Feb 28 10:30:45 2018 + Committer: Sam Corbett Committed: Wed Feb 28 10:30:45 2018 + -- .../jclouds/DefaultConnectivityResolver.java| 40 .../jclouds/AbstractJcloudsLiveTest.java| 5 ++- .../jclouds/JcloudsWinrmingLiveTest.java| 19 ++ 3 files changed, 47 insertions(+), 17 deletions(-) --
[02/18] brooklyn-client git commit: Improve error message when not logged in.
Improve error message when not logged in. Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/653e4f44 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/653e4f44 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/653e4f44 Branch: refs/heads/master Commit: 653e4f4416748bf53c7c0d7a9d20b00a5cd83124 Parents: 2bea036 Author: Geoff MacartneyAuthored: Wed May 24 16:13:42 2017 +0100 Committer: Geoff Macartney Committed: Tue Jul 4 11:06:00 2017 +0100 -- cli/io/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/653e4f44/cli/io/config.go -- diff --git a/cli/io/config.go b/cli/io/config.go index 2c77602..8478d4c 100644 --- a/cli/io/config.go +++ b/cli/io/config.go @@ -190,7 +190,7 @@ func (config *Config) GetNetworkCredentials() (target string, username string, p username, password, err = config.getCredentialsOldStyle(target) } } else { - err = errors.New("No target defined in config file") + err = errors.New("Not logged in") } return target, username, password, err }
[13/18] brooklyn-client git commit: Don't panic on failure to connect to host
Don't panic on failure to connect to host Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/fffaec06 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/fffaec06 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/fffaec06 Branch: refs/heads/master Commit: fffaec0635c2f0549b07c2237360a110834241ca Parents: 749057b Author: Geoff MacartneyAuthored: Tue May 23 16:48:35 2017 +0100 Committer: Geoff Macartney Committed: Tue Jul 4 11:06:00 2017 +0100 -- cli/net/net.go | 6 ++ 1 file changed, 6 insertions(+) -- http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/fffaec06/cli/net/net.go -- diff --git a/cli/net/net.go b/cli/net/net.go index b8d8f40..5415a68 100644 --- a/cli/net/net.go +++ b/cli/net/net.go @@ -29,6 +29,8 @@ import ( "os" "path/filepath" "crypto/tls" + "net" + "time" ) type Network struct { @@ -238,5 +240,9 @@ func VerifyLoginURL(network *Network) error { if url.Host == "" { return errors.New("Use login command to set Brooklyn URL with a valid host[:port]") } + _, err = net.DialTimeout("tcp", url.Host, time.Duration(30) * time.Second) + if err != nil { + return errors.New("Could not connect to " + url.Host) + } return nil }
[10/18] brooklyn-client git commit: base64 encode passwords and simplify .brooklyn_cli structure
base64 encode passwords and simplify .brooklyn_cli structure Includes support for old style .brooklyn_cli format such that it will read credentials from the old style and use them, but overwrite with the new style on next login. New style looks like: { "credentials": { "password": "cGFzc3dvcmQ=", "username": "geoff" }, "skipSslChecks": false, "target": "http://geoffs-macbook-pro.local:8081; } Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/2ec78dd0 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/2ec78dd0 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/2ec78dd0 Branch: refs/heads/master Commit: 2ec78dd09b5b342a219bc085028ae78c5bcfc73c Parents: 6b7970e Author: Geoff MacartneyAuthored: Wed May 24 12:49:56 2017 +0100 Committer: Geoff Macartney Committed: Tue Jul 4 11:06:00 2017 +0100 -- cli/br/brooklyn.go| 25 +++-- cli/commands/login.go | 59 ++--- cli/io/config.go | 124 + 3 files changed, 158 insertions(+), 50 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/2ec78dd0/cli/br/brooklyn.go -- diff --git a/cli/br/brooklyn.go b/cli/br/brooklyn.go index 1ffb765..3250a8f 100644 --- a/cli/br/brooklyn.go +++ b/cli/br/brooklyn.go @@ -30,27 +30,14 @@ import ( "path/filepath" ) -func getNetworkCredentialsFromConfig(yamlMap map[string]interface{}) (string, string, string, bool) { - var target, username, password string - var skipSslChecks bool - target, found := yamlMap["target"].(string) - if found { - auth, found := yamlMap["auth"].(map[string]interface{}) - if found { - creds := auth[target].(map[string]interface{}) - username, found = creds["username"].(string) - if found { - password, found = creds["password"].(string) - } - } - skipSslChecks, _ = yamlMap["skipSslChecks"].(bool) - } - return target, username, password, skipSslChecks -} - func main() { config := io.GetConfig() - target, username, password, skipSslChecks := getNetworkCredentialsFromConfig(config.Map) + skipSslChecks := config.GetSkipSslChecks() + target, username, password, err := config.GetNetworkCredentials() + if err != nil { + error_handler.ErrorExit(err) + } + //target, username, password := "http://192.168.50.101:8081;, "brooklyn", "Sns4Hh9j7l" network := net.NewNetwork(target, username, password, skipSslChecks) cmdFactory := command_factory.NewFactory(network, config) http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/2ec78dd0/cli/commands/login.go -- diff --git a/cli/commands/login.go b/cli/commands/login.go index d7ddb7e..a0459ca 100644 --- a/cli/commands/login.go +++ b/cli/commands/login.go @@ -58,6 +58,30 @@ func (cmd *Login) Metadata() command_metadata.CommandMetadata { } } + +func (cmd *Login) promptAndReadUsername() (username string) { + for username == "" { + reader := bufio.NewReader(os.Stdin) + fmt.Print("Enter Username: ") + user, err := reader.ReadString('\n') + if err != nil { + error_handler.ErrorExit(err) + } + username = strings.TrimSpace(user) + } + return username +} + +func (cmd *Login) promptAndReadPassword() (password string) { + fmt.Print("Enter Password: ") + bytePassword, err := terminal.ReadPassword(int(syscall.Stdin)) + if err != nil { + error_handler.ErrorExit(err) + } + fmt.Printf("\n") + return string(bytePassword) +} + func (cmd *Login) Run(scope scope.Scope, c *cli.Context) { if !c.Args().Present() { error_handler.ErrorExit("A URL must be provided as the first argument", error_handler.CLIUsageErrorExitCode) @@ -83,44 +107,17 @@ func (cmd *Login) Run(scope scope.Scope, c *cli.Context) { // Prompt for username if not supplied if cmd.network.BrooklynUser == "" { - var userName string - for userName == "" { - reader := bufio.NewReader(os.Stdin) - fmt.Print("Enter Username: ") - user, err := reader.ReadString('\n') - if err != nil { -
[12/18] brooklyn-client git commit: Improve login handling.
Improve login handling. See https://issues.apache.org/jira/browse/BROOKLYN-463. Prompt for user name if not supplied. Check for 401 Unauthorized and give tidier output. Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/4d6b4fdf Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/4d6b4fdf Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/4d6b4fdf Branch: refs/heads/master Commit: 4d6b4fdf57088150b33bf14f642a2cce203ff82f Parents: 052d3bd Author: Geoff MacartneyAuthored: Tue Apr 4 14:08:18 2017 +0100 Committer: Geoff Macartney Committed: Tue Jul 4 11:06:00 2017 +0100 -- cli/api/version/version.go | 9 + cli/commands/login.go | 24 ++-- cli/commands/version.go| 2 +- cli/net/net.go | 4 ++-- 4 files changed, 30 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/4d6b4fdf/cli/api/version/version.go -- diff --git a/cli/api/version/version.go b/cli/api/version/version.go index 622068d..243cf5e 100644 --- a/cli/api/version/version.go +++ b/cli/api/version/version.go @@ -24,13 +24,14 @@ import ( "github.com/apache/brooklyn-client/cli/net" ) -func Version(network *net.Network) (models.VersionSummary, error) { +func Version(network *net.Network) (models.VersionSummary, int, error) { url := "/v1/server/version" var versionSummary models.VersionSummary - body, err := network.SendGetRequest(url) + req := network.NewGetRequest(url) + body, code, err := network.SendRequestGetStatusCode(req) if err != nil { - return versionSummary, err + return versionSummary, code, err } err = json.Unmarshal(body, ) - return versionSummary, err + return versionSummary, code, err } http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/4d6b4fdf/cli/commands/login.go -- diff --git a/cli/commands/login.go b/cli/commands/login.go index b0413ce..b264fb0 100644 --- a/cli/commands/login.go +++ b/cli/commands/login.go @@ -21,6 +21,11 @@ package commands import ( "fmt" "syscall" + "bufio" + "os" + "strings" + "net/http" + "errors" "github.com/apache/brooklyn-client/cli/api/version" "github.com/apache/brooklyn-client/cli/command_metadata" @@ -76,6 +81,17 @@ func (cmd *Login) Run(scope scope.Scope, c *cli.Context) { cmd.network.BrooklynUrl = cmd.network.BrooklynUrl[0 : len(cmd.network.BrooklynUrl)-1] } + // Prompt for username if not supplied + if cmd.network.BrooklynUser == "" { + reader := bufio.NewReader(os.Stdin) + fmt.Print("Enter Username: ") + user, err := reader.ReadString('\n') + if err != nil { + error_handler.ErrorExit(err) + } + cmd.network.BrooklynUser = strings.TrimSpace(user) + } + // Prompt for password if not supplied (password is not echoed to screen if cmd.network.BrooklynUser != "" && cmd.network.BrooklynPass == "" { fmt.Print("Enter Password: ") @@ -84,7 +100,8 @@ func (cmd *Login) Run(scope scope.Scope, c *cli.Context) { error_handler.ErrorExit(err) } fmt.Printf("\n") - cmd.network.BrooklynPass = string(bytePassword) + password := string(bytePassword) + cmd.network.BrooklynPass = strings.TrimSpace(password) } if cmd.config.Map == nil { @@ -106,8 +123,11 @@ func (cmd *Login) Run(scope scope.Scope, c *cli.Context) { cmd.config.Map["skipSslChecks"] = cmd.network.SkipSslChecks cmd.config.Write() - loginVersion, err := version.Version(cmd.network) + loginVersion, code, err := version.Version(cmd.network) if nil != err { + if code == http.StatusUnauthorized { + err = errors.New("Unauthorized") + } error_handler.ErrorExit(err) } fmt.Printf("Connected to Brooklyn version %s at %s\n", loginVersion.Version, cmd.network.BrooklynUrl) http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/4d6b4fdf/cli/commands/version.go -- diff --git a/cli/commands/version.go b/cli/commands/version.go index 6cbdf1d..dae6074 100644 --- a/cli/commands/version.go +++ b/cli/commands/version.go @@ -51,7 +51,7 @@ func (cmd *Version) Run(scope
[09/18] brooklyn-client git commit: Rename method to private
Rename method to private Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/25704c5e Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/25704c5e Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/25704c5e Branch: refs/heads/master Commit: 25704c5e4e5e25abacf1b14962bce6b22536e54c Parents: 2ec78dd Author: Geoff MacartneyAuthored: Wed May 24 12:51:46 2017 +0100 Committer: Geoff Macartney Committed: Tue Jul 4 11:06:00 2017 +0100 -- cli/io/config.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/25704c5e/cli/io/config.go -- diff --git a/cli/io/config.go b/cli/io/config.go index 372c59c..23312f8 100644 --- a/cli/io/config.go +++ b/cli/io/config.go @@ -55,7 +55,7 @@ func GetConfig() (config *Config) { config.Map = make(map[string]interface{}) config.Write() } - config.Read() + config.read() return } @@ -79,7 +79,7 @@ func (config *Config) Write() { enc.Encode(config.Map) } -func (config *Config) Read() { +func (config *Config) read() { fileToRead, err := os.Open(config.FilePath) if err != nil { error_handler.ErrorExit(err)
[16/18] brooklyn-client git commit: Add licence header to config_test.go
Add licence header to config_test.go Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/b5e51e42 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/b5e51e42 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/b5e51e42 Branch: refs/heads/master Commit: b5e51e420aab89ad34cbf5581f3de520220263c7 Parents: 92de0b6 Author: Geoff MacartneyAuthored: Tue Jul 4 16:08:35 2017 +0100 Committer: Geoff Macartney Committed: Tue Jul 4 16:08:35 2017 +0100 -- cli/io/config_test.go | 18 ++ 1 file changed, 18 insertions(+) -- http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/b5e51e42/cli/io/config_test.go -- diff --git a/cli/io/config_test.go b/cli/io/config_test.go index 860dcc4..9f14c19 100644 --- a/cli/io/config_test.go +++ b/cli/io/config_test.go @@ -1,3 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 io import (
[06/18] brooklyn-client git commit: Add logout command
Add logout command Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/6b7970e1 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/6b7970e1 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/6b7970e1 Branch: refs/heads/master Commit: 6b7970e1459b10770a8a528e498f6515892b18b8 Parents: 2ac0e7a Author: Geoff MacartneyAuthored: Tue May 23 19:34:23 2017 +0100 Committer: Geoff Macartney Committed: Tue Jul 4 11:06:00 2017 +0100 -- cli/command_factory/factory.go | 1 + cli/commands/logout.go | 57 + cli/io/config.go | 8 ++ 3 files changed, 66 insertions(+) -- http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/6b7970e1/cli/command_factory/factory.go -- diff --git a/cli/command_factory/factory.go b/cli/command_factory/factory.go index 399014f..4112a53 100644 --- a/cli/command_factory/factory.go +++ b/cli/command_factory/factory.go @@ -70,6 +70,7 @@ func NewFactory(network *net.Network, config *io.Config) (factory concreteFactor // factory.superCommand(commands.NewList(network)) factory.simpleCommand(commands.NewLocations(network)) factory.simpleCommand(commands.NewLogin(network, config)) + factory.simpleCommand(commands.NewLogout(network, config)) factory.simpleCommand(commands.NewPolicy(network)) factory.simpleCommand(commands.NewRename(network)) factory.simpleCommand(commands.NewSensor(network)) http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/6b7970e1/cli/commands/logout.go -- diff --git a/cli/commands/logout.go b/cli/commands/logout.go new file mode 100644 index 000..a86eb20 --- /dev/null +++ b/cli/commands/logout.go @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 commands + +import ( + "github.com/apache/brooklyn-client/cli/command_metadata" + "github.com/apache/brooklyn-client/cli/error_handler" + "github.com/apache/brooklyn-client/cli/io" + "github.com/apache/brooklyn-client/cli/net" + "github.com/apache/brooklyn-client/cli/scope" + "github.com/urfave/cli" +) + +type Logout struct { + network *net.Network + config *io.Config +} + +func NewLogout(network *net.Network, config *io.Config) (cmd *Logout) { + cmd = new(Logout) + cmd.network = network + cmd.config = config + return +} + +func (cmd *Logout) Metadata() command_metadata.CommandMetadata { + return command_metadata.CommandMetadata{ + Name:"logout", + Description: "Logout of brooklyn", + Usage: "BROOKLYN_NAME logout", + Flags: []cli.Flag{}, + } +} + +func (cmd *Logout) Run(scope scope.Scope, c *cli.Context) { + config := io.GetConfig() + err := config.Delete() + if err != nil { + error_handler.ErrorExit(err) + } +} http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/6b7970e1/cli/io/config.go -- diff --git a/cli/io/config.go b/cli/io/config.go index 12d2803..662ae24 100644 --- a/cli/io/config.go +++ b/cli/io/config.go @@ -48,6 +48,14 @@ func GetConfig() (config *Config) { return } + +func (config *Config) Delete() (err error) { + if _, err := os.Stat(config.FilePath); err == nil { + err = os.Remove(config.FilePath) + } + return err +} + func (config *Config) Write() { // Create file as read/write by user (but does not change perms of existing file) fileToWrite, err := os.OpenFile(config.FilePath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600)
[11/18] brooklyn-client git commit: Simply the format even more: encode username and password
Simply the format even more: encode username and password Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/86acc705 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/86acc705 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/86acc705 Branch: refs/heads/master Commit: 86acc705958d916f27f6b1497bd98f24c98a1ed5 Parents: 25704c5 Author: Geoff MacartneyAuthored: Wed May 24 14:19:10 2017 +0100 Committer: Geoff Macartney Committed: Tue Jul 4 11:06:00 2017 +0100 -- cli/io/config.go | 46 +- 1 file changed, 25 insertions(+), 21 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/86acc705/cli/io/config.go -- diff --git a/cli/io/config.go b/cli/io/config.go index 23312f8..2c77602 100644 --- a/cli/io/config.go +++ b/cli/io/config.go @@ -26,6 +26,8 @@ import ( "github.com/apache/brooklyn-client/cli/error_handler" "encoding/base64" "errors" + "strings" + "bytes" ) // Deprecated: support old style of .brooklyn_cli format for version <= 0.11.0 @@ -70,13 +72,20 @@ func (config *Config) Delete() (err error) { func (config *Config) Write() { // Create file as read/write by user (but does not change perms of existing file) fileToWrite, err := os.OpenFile(config.FilePath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600) + defer fileToWrite.Close() if err != nil { error_handler.ErrorExit(err) } - defer fileToWrite.Close() - enc := json.NewEncoder(fileToWrite) - enc.Encode(config.Map) + marshalledMap, err := json.Marshal(config.Map) + if err != nil { + error_handler.ErrorExit(err) + } + var formatted bytes.Buffer + if err = json.Indent(, marshalledMap, "", ""); err != nil { + error_handler.ErrorExit(err) + } + fileToWrite.Write(formatted.Bytes()) } func (config *Config) read() { @@ -102,26 +111,23 @@ func (config *Config) read() { // "target": "http://geoffs-macbook-pro.local:8081; //} func (config *Config) getCredentials(target string) (username string, password string, err error) { - credentials, found := config.Map[credentialsKey].(map[string]interface{}) + credentials, found := config.Map[credentialsKey].(string) if !found { err = errors.New("No credentials found for " + target) return } - if username, found = credentials["username"].(string); !found { - err = errors.New("No credentials for " + target) - return - } - - if password, found = credentials["password"].(string); !found { - err = errors.New("No credentials for " + target) + if decoded, errd := base64.StdEncoding.DecodeString(credentials); errd != nil { + err = errors.New("Could not decode credentials for " + target) return - } - - if decodedPassword, err := base64.StdEncoding.DecodeString(password); err != nil { - err = errors.New("Could not decode password for " + username) } else { - password = string(decodedPassword) + userAndPassword := strings.SplitN(string(decoded), ":", 2) + if len(userAndPassword) != 2 { + err = errors.New("Invalid credentials for " + target) + return + } + username = userAndPassword[0] + password = userAndPassword[1] } return username, password, err } @@ -168,11 +174,9 @@ func (config *Config) SetNetworkCredentials(target string, username string, pass if config.Map == nil { config.Map = make(map[string]interface{}) } - encodedPassword := base64.StdEncoding.EncodeToString([]byte(password)) - config.Map[credentialsKey] = map[string]interface{}{ - usernameKey: username, - secretKey: encodedPassword, - } + userAndPassword := username + ":" + password + encodedCredentials := base64.StdEncoding.EncodeToString([]byte(userAndPassword)) + config.Map[credentialsKey] = encodedCredentials config.Map[targetKey] = target // Overwrite old style format from version <= 0.11.0
[08/18] brooklyn-client git commit: Add a br server command.
Add a br server command. Displays the URL of the connected Brooklyn. Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/2bea0368 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/2bea0368 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/2bea0368 Branch: refs/heads/master Commit: 2bea03683699745933d2f37c7b41f1b7f69ec21e Parents: 86acc70 Author: Geoff MacartneyAuthored: Wed May 24 15:15:25 2017 +0100 Committer: Geoff Macartney Committed: Tue Jul 4 11:06:00 2017 +0100 -- cli/command_factory/factory.go | 1 + cli/commands/server.go | 50 + 2 files changed, 51 insertions(+) -- http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/2bea0368/cli/command_factory/factory.go -- diff --git a/cli/command_factory/factory.go b/cli/command_factory/factory.go index 4112a53..65ed65e 100644 --- a/cli/command_factory/factory.go +++ b/cli/command_factory/factory.go @@ -74,6 +74,7 @@ func NewFactory(network *net.Network, config *io.Config) (factory concreteFactor factory.simpleCommand(commands.NewPolicy(network)) factory.simpleCommand(commands.NewRename(network)) factory.simpleCommand(commands.NewSensor(network)) + factory.simpleCommand(commands.NewServer(network)) factory.simpleCommand(commands.NewSetConfig(network)) factory.simpleCommand(commands.NewSpec(network)) factory.simpleCommand(commands.NewStartPolicy(network)) http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/2bea0368/cli/commands/server.go -- diff --git a/cli/commands/server.go b/cli/commands/server.go new file mode 100644 index 000..553ce82 --- /dev/null +++ b/cli/commands/server.go @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Server 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 commands + +import ( + "github.com/apache/brooklyn-client/cli/command_metadata" + "github.com/apache/brooklyn-client/cli/net" + "github.com/apache/brooklyn-client/cli/scope" + "github.com/urfave/cli" + "fmt" +) + +type Server struct { + network *net.Network +} + +func NewServer(network *net.Network) (cmd *Server) { + cmd = new(Server) + cmd.network = network + return +} + +func (cmd *Server) Metadata() command_metadata.CommandMetadata { + return command_metadata.CommandMetadata{ + Name:"server", + Description: "Display the URL of the connected Brooklyn", + Usage: "BROOKLYN_NAME server", + Flags: []cli.Flag{}, + } +} + +func (cmd *Server) Run(scope scope.Scope, c *cli.Context) { + fmt.Println(cmd.network.BrooklynUrl) +}
[07/18] brooklyn-client git commit: Don't store all old logins in .brooklyn_cli
Don't store all old logins in .brooklyn_cli Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/2ac0e7a1 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/2ac0e7a1 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/2ac0e7a1 Branch: refs/heads/master Commit: 2ac0e7a12e004c507203430a522cfd44b4a83227 Parents: 326459c Author: Geoff MacartneyAuthored: Tue May 23 17:42:16 2017 +0100 Committer: Geoff Macartney Committed: Tue Jul 4 11:06:00 2017 +0100 -- cli/commands/login.go | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/2ac0e7a1/cli/commands/login.go -- diff --git a/cli/commands/login.go b/cli/commands/login.go index 84e13b3..d7ddb7e 100644 --- a/cli/commands/login.go +++ b/cli/commands/login.go @@ -111,11 +111,8 @@ func (cmd *Login) Run(scope scope.Scope, c *cli.Context) { cmd.config.Map = make(map[string]interface{}) } // now persist these credentials to the yaml file - auth, ok := cmd.config.Map["auth"].(map[string]interface{}) - if !ok { - auth = make(map[string]interface{}) - cmd.config.Map["auth"] = auth - } + auth := make(map[string]interface{}) + cmd.config.Map["auth"] = auth auth[cmd.network.BrooklynUrl] = map[string]string{ "username": cmd.network.BrooklynUser,
[04/18] brooklyn-client git commit: Handle newline/spaces in prompt for username
Handle newline/spaces in prompt for username Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/b73bc2d5 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/b73bc2d5 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/b73bc2d5 Branch: refs/heads/master Commit: b73bc2d5a7973aabe42422ba211036372e72e5db Parents: fffaec0 Author: Geoff MacartneyAuthored: Tue May 23 17:08:15 2017 +0100 Committer: Geoff Macartney Committed: Tue Jul 4 11:06:00 2017 +0100 -- cli/commands/login.go | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/b73bc2d5/cli/commands/login.go -- diff --git a/cli/commands/login.go b/cli/commands/login.go index b2ab208..84e13b3 100644 --- a/cli/commands/login.go +++ b/cli/commands/login.go @@ -83,13 +83,17 @@ func (cmd *Login) Run(scope scope.Scope, c *cli.Context) { // Prompt for username if not supplied if cmd.network.BrooklynUser == "" { - reader := bufio.NewReader(os.Stdin) - fmt.Print("Enter Username: ") - user, err := reader.ReadString('\n') - if err != nil { - error_handler.ErrorExit(err) + var userName string + for userName == "" { + reader := bufio.NewReader(os.Stdin) + fmt.Print("Enter Username: ") + user, err := reader.ReadString('\n') + if err != nil { + error_handler.ErrorExit(err) + } + userName = strings.TrimSpace(user) } - cmd.network.BrooklynUser = strings.TrimSpace(user) + cmd.network.BrooklynUser = userName } // Prompt for password if not supplied (password is not echoed to screen
[18/18] brooklyn-client git commit: This closes #42
This closes #42 Improve login handling. Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/be805160 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/be805160 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/be805160 Branch: refs/heads/master Commit: be8051602b7bc2ad7bf0c1975aad55d7f354048a Parents: 052d3bd 6abe8d1 Author: Sam CorbettAuthored: Mon Jul 17 13:03:05 2017 +0100 Committer: Sam Corbett Committed: Mon Jul 17 13:03:05 2017 +0100 -- cli/api/version/version.go | 9 +- cli/br/brooklyn.go | 55 +++ cli/command_factory/factory.go | 2 + cli/commands/login.go | 80 ++- cli/commands/logout.go | 57 +++ cli/commands/server.go | 50 ++ cli/commands/version.go| 2 +- cli/io/config.go | 189 +++- cli/io/config_test.go | 63 cli/io/legacyConfig.json | 14 +++ cli/io/testconfig.json | 8 ++ cli/net/net.go | 8 +- 12 files changed, 482 insertions(+), 55 deletions(-) --
[14/18] brooklyn-client git commit: Revert to keeping multiple credentials in the config file
Revert to keeping multiple credentials in the config file per https://github.com/apache/brooklyn-client/pull/42#issuecomment-303995483 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/61df6a2f Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/61df6a2f Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/61df6a2f Branch: refs/heads/master Commit: 61df6a2f2464aa5bf1bac4ec656b25c95f8f9eed Parents: bca4c07 Author: Geoff MacartneyAuthored: Tue Jul 4 14:20:46 2017 +0100 Committer: Geoff Macartney Committed: Tue Jul 4 14:20:46 2017 +0100 -- cli/io/config.go | 63 --- 1 file changed, 50 insertions(+), 13 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/61df6a2f/cli/io/config.go -- diff --git a/cli/io/config.go b/cli/io/config.go index 8478d4c..6b3aecd 100644 --- a/cli/io/config.go +++ b/cli/io/config.go @@ -35,7 +35,7 @@ const authKey = "auth" const credentialsKey = "credentials" const usernameKey = "username" -const secretKey = "password" +const passwordKey = "password" const targetKey = "target" const skipSslChecksKey = "skipSslChecks" @@ -103,21 +103,27 @@ func (config *Config) read() { // getCredentials reads credentials from .brooklyn_cli data formatted for versions > 0.11.0 // Note that the password is base64 encoded to avoid json formatting problems //{ -// "credentials": { -// "password": "cGFzc3dvcmQ=", -// "username": "geoff" -// }, -// "skipSslChecks": false, -// "target": "http://geoffs-macbook-pro.local:8081; +//"credentials": { +//"http://geoffs-macbook-pro.local:8081": "Z2VvZmY6cGFzc3dvcmQ=" +//}, +//"skipSslChecks": false, +//"target": "http://geoffs-macbook-pro.local:8081; //} + func (config *Config) getCredentials(target string) (username string, password string, err error) { - credentials, found := config.Map[credentialsKey].(string) + credentials, found := config.Map[credentialsKey].(map[string]interface{}) if !found { - err = errors.New("No credentials found for " + target) + err = errors.New("No credentials found in configuration") return } - if decoded, errd := base64.StdEncoding.DecodeString(credentials); errd != nil { + creds, found := credentials[target].(string) + if !found { + err = errors.New("No credentials found in configuration for " + target) + return + } + + if decoded, errd := base64.StdEncoding.DecodeString(creds); errd != nil { err = errors.New("Could not decode credentials for " + target) return } else { @@ -162,7 +168,7 @@ func (config *Config) getCredentialsOldStyle(target string) (username string, pa return } - if password, found = creds[secretKey].(string); !found { + if password, found = creds[passwordKey].(string); !found { err = errors.New("No credentials for " + username) return } @@ -170,19 +176,50 @@ func (config *Config) getCredentialsOldStyle(target string) (username string, pa return username, password, err } -func (config *Config) SetNetworkCredentials(target string, username string, password string) { +func (config *Config) initialize() { if config.Map == nil { config.Map = make(map[string]interface{}) } + if _, found := config.Map[credentialsKey]; !found { + config.Map[credentialsKey] = make(map[string]interface{}) + } +} + +func (config *Config) setCredential(target string, username string, password string) { + credentialsMap := config.Map[credentialsKey].(map[string]interface{}) userAndPassword := username + ":" + password encodedCredentials := base64.StdEncoding.EncodeToString([]byte(userAndPassword)) - config.Map[credentialsKey] = encodedCredentials + credentialsMap[target] = encodedCredentials +} + +func (config *Config) SetNetworkCredentials(target string, username string, password string) { + config.initialize() + config.adaptLegacyCredentialFormat() + config.setCredential(target, username, password) config.Map[targetKey] = target // Overwrite old style format from version <= 0.11.0 delete(config.Map, authKey) } +func (config *Config) adaptLegacyCredentialFormat() { + auth, found := config.Map[authKey].(map[string]interface{}) + if !found { + return + } + for url, credMap := range auth { +
[03/18] brooklyn-client git commit: Don't use resp if there was an error
Don't use resp if there was an error Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/326459c4 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/326459c4 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/326459c4 Branch: refs/heads/master Commit: 326459c4f80ddcbb7998f2f34fc7b6d6f0512e99 Parents: b73bc2d Author: Geoff MacartneyAuthored: Tue May 23 17:08:45 2017 +0100 Committer: Geoff Macartney Committed: Tue Jul 4 11:06:00 2017 +0100 -- cli/net/net.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/326459c4/cli/net/net.go -- diff --git a/cli/net/net.go b/cli/net/net.go index 5415a68..38f050e 100644 --- a/cli/net/net.go +++ b/cli/net/net.go @@ -123,7 +123,7 @@ func (net *Network) SendRequestGetStatusCode(req *http.Request) ([]byte, int, er client := net.makeClient() resp, err := client.Do(req) if err != nil { - return nil, resp.StatusCode, err + return nil, 0, err } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body)
[01/18] brooklyn-client git commit: Ignore invalid config during login and remove config upon failure
Repository: brooklyn-client Updated Branches: refs/heads/master 052d3bdae -> be8051602 Ignore invalid config during login and remove config upon failure Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/bca4c072 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/bca4c072 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/bca4c072 Branch: refs/heads/master Commit: bca4c0729b2a41c88ffe814c28da63d2dffca147 Parents: 653e4f4 Author: Geoff MacartneyAuthored: Wed May 24 20:43:08 2017 +0100 Committer: Geoff Macartney Committed: Tue Jul 4 11:06:00 2017 +0100 -- cli/br/brooklyn.go| 6 +- cli/commands/login.go | 4 2 files changed, 9 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/bca4c072/cli/br/brooklyn.go -- diff --git a/cli/br/brooklyn.go b/cli/br/brooklyn.go index 3250a8f..b753d42 100644 --- a/cli/br/brooklyn.go +++ b/cli/br/brooklyn.go @@ -34,7 +34,7 @@ func main() { config := io.GetConfig() skipSslChecks := config.GetSkipSslChecks() target, username, password, err := config.GetNetworkCredentials() - if err != nil { + if err != nil && !isLogin(os.Args) { error_handler.ErrorExit(err) } @@ -50,3 +50,7 @@ func main() { error_handler.ErrorExit(err) } } + +func isLogin(args []string) bool { + return len(args) > 1 && args[1] == "login" +} http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/bca4c072/cli/commands/login.go -- diff --git a/cli/commands/login.go b/cli/commands/login.go index a0459ca..78f8852 100644 --- a/cli/commands/login.go +++ b/cli/commands/login.go @@ -93,6 +93,9 @@ func (cmd *Login) Run(scope scope.Scope, c *cli.Context) { cmd.network.BrooklynPass = c.Args().Get(2) cmd.network.SkipSslChecks = c.Bool("skipSslChecks") + // invalidate current credentials record + io.GetConfig().Delete() + if err := net.VerifyLoginURL(cmd.network); err != nil { error_handler.ErrorExit(err) } @@ -125,6 +128,7 @@ func (cmd *Login) Run(scope scope.Scope, c *cli.Context) { if code == http.StatusUnauthorized { err = errors.New("Unauthorized") } + cmd.config.Delete() error_handler.ErrorExit(err) } fmt.Printf("Connected to Brooklyn version %s at %s\n", loginVersion.Version, cmd.network.BrooklynUrl)
[05/18] brooklyn-client git commit: Don't trim password.
Don't trim password. Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/749057bb Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/749057bb Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/749057bb Branch: refs/heads/master Commit: 749057bb61a6bb409a7f81cd584a17a1d831d2cb Parents: 4d6b4fd Author: Geoff MacartneyAuthored: Tue Apr 4 15:26:31 2017 +0100 Committer: Geoff Macartney Committed: Tue Jul 4 11:06:00 2017 +0100 -- cli/commands/login.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/749057bb/cli/commands/login.go -- diff --git a/cli/commands/login.go b/cli/commands/login.go index b264fb0..b2ab208 100644 --- a/cli/commands/login.go +++ b/cli/commands/login.go @@ -100,8 +100,7 @@ func (cmd *Login) Run(scope scope.Scope, c *cli.Context) { error_handler.ErrorExit(err) } fmt.Printf("\n") - password := string(bytePassword) - cmd.network.BrooklynPass = strings.TrimSpace(password) + cmd.network.BrooklynPass = string(bytePassword) } if cmd.config.Map == nil {
[17/18] brooklyn-client git commit: Ensure logout does not prevent help being displayed
Ensure logout does not prevent help being displayed Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/6abe8d11 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/6abe8d11 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/6abe8d11 Branch: refs/heads/master Commit: 6abe8d11ad76827fb25fb6d9a011e96d13c5d9a2 Parents: b5e51e4 Author: Geoff MacartneyAuthored: Thu Jul 13 17:07:32 2017 +0100 Committer: Geoff Macartney Committed: Mon Jul 17 12:56:24 2017 +0100 -- cli/br/brooklyn.go| 32 +--- cli/io/config_test.go | 4 ++-- 2 files changed, 31 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/6abe8d11/cli/br/brooklyn.go -- diff --git a/cli/br/brooklyn.go b/cli/br/brooklyn.go index b753d42..08c4473 100644 --- a/cli/br/brooklyn.go +++ b/cli/br/brooklyn.go @@ -34,7 +34,7 @@ func main() { config := io.GetConfig() skipSslChecks := config.GetSkipSslChecks() target, username, password, err := config.GetNetworkCredentials() - if err != nil && !isLogin(os.Args) { + if err != nil && requiresLogin(os.Args) { error_handler.ErrorExit(err) } @@ -51,6 +51,32 @@ func main() { } } -func isLogin(args []string) bool { - return len(args) > 1 && args[1] == "login" +func requiresLogin(args []string) bool { + // global help or version commands + if (contains(args, "-h") || + contains(args, "--help") || + contains(args, "-v") || + contains(args, "--version")) { + return false + } + // br on its own + if (len(args) == 1) { + return false + } + // + if (len(args) > 1) { + if (args[1] == "login" || args[1] == "help") { + return false + } + } + return true } + +func contains(slice []string, val string) bool { + for _, a := range slice { + if a == val { + return true + } + } + return false +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/6abe8d11/cli/io/config_test.go -- diff --git a/cli/io/config_test.go b/cli/io/config_test.go index 9f14c19..3d547af 100644 --- a/cli/io/config_test.go +++ b/cli/io/config_test.go @@ -19,8 +19,8 @@ package io import ( - "testing" "path/filepath" + "testing" ) func TestConfig(t *testing.T) { @@ -60,4 +60,4 @@ func assertUserPassword(err error, t *testing.T, username string, expectedUser s if password != expectedPassword { t.Errorf("password != %s: %s", expectedPassword, username) } -} \ No newline at end of file +}
[3/4] brooklyn-server git commit: Upgrade to jclouds 2.1.0-SNAPSHOT
Upgrade to jclouds 2.1.0-SNAPSHOT Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/1259e283 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/1259e283 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/1259e283 Branch: refs/heads/master Commit: 1259e2832829d67148a42cbbb07400cc94a06587 Parents: 757a38c Author: Svetoslav NeykovAuthored: Mon May 8 19:40:14 2017 +0300 Committer: Sam Corbett Committed: Wed May 24 15:40:49 2017 +0100 -- karaf/features/src/main/feature/feature.xml | 3 ++- pom.xml | 6 -- 2 files changed, 6 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/1259e283/karaf/features/src/main/feature/feature.xml -- diff --git a/karaf/features/src/main/feature/feature.xml b/karaf/features/src/main/feature/feature.xml index d4d348e..c88673d 100644 --- a/karaf/features/src/main/feature/feature.xml +++ b/karaf/features/src/main/feature/feature.xml @@ -145,7 +145,8 @@ mvn:com.thoughtworks.xstream/xstream/${xstream.version} mvn:org.freemarker/freemarker/${freemarker.version} mvn:com.hierynomus/sshj/${sshj.version} -mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jzlib/1.1.3_2 +mvn:net.i2p.crypto/eddsa/${eddsa.version} +mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jzlib/${jzlib.servicemix.version} mvn:org.bouncycastle/bcprov-ext-jdk15on/${bouncycastle.version} mvn:org.bouncycastle/bcpkix-jdk15on/${bouncycastle.version} mvn:commons-codec/commons-codec/${commons-codec.version} http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/1259e283/pom.xml -- diff --git a/pom.xml b/pom.xml index 1055245..a9b43b1 100644 --- a/pom.xml +++ b/pom.xml @@ -101,7 +101,7 @@ false -2.0.1 +2.1.0-SNAPSHOT 1.0.7 1.6.6 @@ -115,6 +115,8 @@ 1.4.8 1.1.4c_7 2.3.0_3 +1.1.3_2 +0.1.0 2.7.5 3.1.10 @@ -133,7 +135,7 @@ 2.2.0 3.0.1 1.51 -0.12.0 +0.20.0 5.6.1 0.9.9-RC1 9.2.13.v20150730
[4/4] brooklyn-server git commit: This closes #696
This closes #696 Fix DslYamlTest Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/b84ec023 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/b84ec023 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/b84ec023 Branch: refs/heads/master Commit: b84ec0231bdc305a87bf771fa6c43e6ebf0d1d25 Parents: 1259e28 3200ee8 Author: Sam CorbettAuthored: Wed May 24 15:44:35 2017 +0100 Committer: Sam Corbett Committed: Wed May 24 15:44:35 2017 +0100 -- .../camp/brooklyn/spi/dsl/DslYamlTest.java | 31 1 file changed, 18 insertions(+), 13 deletions(-) --
[1/4] brooklyn-server git commit: Fix DslYamlTest’s getConfigEventually
Repository: brooklyn-server Updated Branches: refs/heads/master 757a38cc4 -> b84ec0231 Fix DslYamlTest’s getConfigEventually Call config().get(), and then config.getNonBlocking(). Previously did it the other way around, so the getNonBlocking could return absent if the value was not yet available. Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/a4b13773 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/a4b13773 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/a4b13773 Branch: refs/heads/master Commit: a4b137730c9f08a61cb82aafacaea2fd1dc3ada7 Parents: 757a38c Author: Aled SageAuthored: Wed May 24 12:43:35 2017 +0100 Committer: Aled Sage Committed: Wed May 24 12:43:35 2017 +0100 -- .../org/apache/brooklyn/camp/brooklyn/spi/dsl/DslYamlTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a4b13773/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslYamlTest.java -- diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslYamlTest.java index 5eba70a..c8463e6 100644 --- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslYamlTest.java +++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/DslYamlTest.java @@ -763,8 +763,8 @@ public class DslYamlTest extends AbstractYamlTest { public T call() throws Exception { // TODO Move the getNonBlocking call out of the task after #480 is merged. // Currently doesn't work because no execution context available. -Maybe immediateValue = ((EntityInternal)entity).config().getNonBlocking(configKey); T blockingValue = entity.config().get(configKey); +Maybe immediateValue = ((EntityInternal)entity).config().getNonBlocking(configKey); assertEquals(immediateValue.get(), blockingValue); return blockingValue; }
[4/4] brooklyn-server git commit: This closes #602
This closes #602 Add test illustrating SNI connection problem. Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/b7fef0f7 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/b7fef0f7 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/b7fef0f7 Branch: refs/heads/master Commit: b7fef0f7051860d1005b71653522417cb23fdbd1 Parents: 8dfd4f0 c541ebe Author: Sam CorbettAuthored: Fri Mar 24 18:47:43 2017 + Committer: Sam Corbett Committed: Fri Mar 24 18:47:43 2017 + -- .../util/core/http/HttpToolSNITest.java | 70 1 file changed, 70 insertions(+) --
[2/4] brooklyn-server git commit: Improve test location rebind stub
Improve test location rebind stub * Makes the stubbed location more functional by implementing the getNodeMetadata, setting the location field on the NodeMetadata; * Disabled aws hostname lookup - nothing to ssh into; * Sets the HA manager for the new rebind management context to disabled. This fixes it to return MASTER state. That's what the launcher does when no HA configured. Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/7ce6f0d1 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/7ce6f0d1 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/7ce6f0d1 Branch: refs/heads/master Commit: 7ce6f0d1fd229f6c31e99a89c98eb8c9f0f9fd73 Parents: 9d3780a Author: Svetoslav NeykovAuthored: Wed Mar 22 18:28:51 2017 +0200 Committer: Svetoslav Neykov Committed: Wed Mar 22 21:55:19 2017 +0200 -- .../brooklyn/AbstractJcloudsStubYamlTest.java | 1 + .../core/mgmt/rebind/RebindTestUtils.java | 1 + .../jclouds/AbstractJcloudsStubbedUnitTest.java | 1 + .../jclouds/JcloudsRebindStubUnitTest.java | 5 +++- .../jclouds/StubbedComputeServiceRegistry.java | 26 5 files changed, 33 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/7ce6f0d1/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractJcloudsStubYamlTest.java -- diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractJcloudsStubYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractJcloudsStubYamlTest.java index fb3255f..380c132 100644 --- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractJcloudsStubYamlTest.java +++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractJcloudsStubYamlTest.java @@ -115,6 +115,7 @@ public abstract class AbstractJcloudsStubYamlTest extends AbstractJcloudsStubbed "brooklyn.config:", " identity: myidentity", " credential: mycredential", +" lookupAwsHostname: false", " jclouds.computeServiceRegistry:", "$brooklyn:object:", " type: " + ByonComputeServiceStaticRef.class.getName(), http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/7ce6f0d1/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindTestUtils.java -- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindTestUtils.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindTestUtils.java index f274ad5..fa59b5a 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindTestUtils.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindTestUtils.java @@ -238,6 +238,7 @@ public class RebindTestUtils { classLoader); ((RebindManagerImpl) unstarted.getRebindManager()).setPeriodicPersistPeriod(persistPeriod); unstarted.getRebindManager().setPersister(newPersister, PersistenceExceptionHandlerImpl.builder().build()); +unstarted.getHighAvailabilityManager().disabled(); // set the HA persister, in case any children want to use HA unstarted.getHighAvailabilityManager().setPersister(new ManagementPlaneSyncRecordPersisterToObjectStore(unstarted, objectStore, classLoader)); return unstarted; http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/7ce6f0d1/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/AbstractJcloudsStubbedUnitTest.java -- diff --git a/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/AbstractJcloudsStubbedUnitTest.java b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/AbstractJcloudsStubbedUnitTest.java index 0eef3a6..37231be 100644 --- a/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/AbstractJcloudsStubbedUnitTest.java +++ b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/AbstractJcloudsStubbedUnitTest.java @@ -100,6 +100,7 @@ public abstract class AbstractJcloudsStubbedUnitTest extends AbstractJcloudsLive .put(SshMachineLocation.SSH_TOOL_CLASS, RecordingSshTool.class.getName()) .put(WinRmMachineLocation.WINRM_TOOL_CLASS, RecordingWinRmTool.class.getName()) .put(JcloudsLocation.POLL_FOR_FIRST_REACHABLE_ADDRESS_PREDICATE,
[1/4] brooklyn-server git commit: Add test illustrating SNI connection problem.
Repository: brooklyn-server Updated Branches: refs/heads/master 05a86be47 -> b7fef0f70 Add test illustrating SNI connection problem. See https://issues.apache.org/jira/browse/BROOKLYN-456. Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/c541ebe7 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/c541ebe7 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/c541ebe7 Branch: refs/heads/master Commit: c541ebe7a748d8a6e244c4ee07eabb08abfae9d7 Parents: b34e256 Author: Geoff MacartneyAuthored: Mon Mar 20 21:05:55 2017 + Committer: Geoff Macartney Committed: Mon Mar 20 21:05:55 2017 + -- .../util/core/http/HttpToolSNITest.java | 70 1 file changed, 70 insertions(+) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/c541ebe7/core/src/test/java/org/apache/brooklyn/util/core/http/HttpToolSNITest.java -- diff --git a/core/src/test/java/org/apache/brooklyn/util/core/http/HttpToolSNITest.java b/core/src/test/java/org/apache/brooklyn/util/core/http/HttpToolSNITest.java new file mode 100644 index 000..a8ffefb --- /dev/null +++ b/core/src/test/java/org/apache/brooklyn/util/core/http/HttpToolSNITest.java @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.apache.brooklyn.util.core.http; + +import static org.testng.Assert.assertEquals; + +import java.net.URI; + +import org.apache.brooklyn.util.http.HttpTool; +import org.apache.http.client.HttpClient; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableMap; + + +/* + A test illustrating failure to connect to a site (https://httpbin.org) that requires SSL SNI (Server Naming + Indication), see https://issues.apache.org/jira/browse/BROOKLYN-456. + + setup() adds debug output, look for the following lines in the output: + + *** ClientHello, TLSv1.2 +RandomCookie: GMT: 1473261907 bytes = { 196, 87, 35, 69, 71, 71, 215, 118, 246, 113, 0, 129, 18, 108, 212, 242, 67, 91, 158, 8, 78, 208, 233, 111, 82, 140, 106, 17 } +Session ID: {} +Cipher Suites: [... blabla lots of suites... ] +Compression Methods: { 0 } +Extension elliptic_curves, curve names: {secp256r1, secp384r1, secp521r1, sect283k1, sect283r1, sect409k1, sect409r1, sect571k1, sect571r1, secp256k1} +Extension ec_point_formats, formats: [uncompressed] +Extension signature_algorithms, signature_algorithms: SHA512withECDSA, SHA512withRSA, SHA384withECDSA, SHA384withRSA, SHA256withECDSA, SHA256withRSA, SHA256withDSA, SHA224withECDSA, SHA224withRSA, SHA224withDSA, SHA1withECDSA, SHA1withRSA, SHA1withDSA +*** + + Note above that there are three "extension" items, ("elliptic_curves", "ec_point_formats", "signature_algorithms"), + but among them there is no "server_name" extension. + + The result is that the initial SSL handshake fails with "SSLException: Received fatal alert: internal_error". + + */ +public class HttpToolSNITest { +@BeforeMethod(alwaysRun=true) +public void setUp() throws Exception { +System.setProperty("javax.net.debug", "ssl:handshake"); +} + + +@Test(groups = {"Integration", "Broken"}) +public void testHttpGetRequiringSNI() throws Exception { +URI baseUri = new URI("https://httpbin.org/get?id=myId;); + +HttpClient client = org.apache.brooklyn.util.http.HttpTool.httpClientBuilder().build(); +org.apache.brooklyn.util.http.HttpToolResponse result = HttpTool.httpGet(client, baseUri, ImmutableMap. of()); +assertEquals(result.getResponseCode(), 200); +} +}
[3/4] brooklyn-server git commit: This closes #607
This closes #607 Improve test location rebind stub Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/8dfd4f01 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/8dfd4f01 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/8dfd4f01 Branch: refs/heads/master Commit: 8dfd4f01686a87b4f0e9c0af081d1be33b6b2876 Parents: 05a86be 7ce6f0d Author: Sam CorbettAuthored: Fri Mar 24 18:47:29 2017 + Committer: Sam Corbett Committed: Fri Mar 24 18:47:29 2017 + -- .../brooklyn/AbstractJcloudsStubYamlTest.java | 1 + .../core/mgmt/rebind/RebindTestUtils.java | 1 + .../jclouds/AbstractJcloudsStubbedUnitTest.java | 1 + .../jclouds/JcloudsRebindStubUnitTest.java | 5 +++- .../jclouds/StubbedComputeServiceRegistry.java | 26 5 files changed, 33 insertions(+), 1 deletion(-) --
[6/6] brooklyn-server git commit: This closes #610
This closes #610 Various integration test fixes Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/05a86be4 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/05a86be4 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/05a86be4 Branch: refs/heads/master Commit: 05a86be471ea7776b62999b004b61eb69cefd2ca Parents: 23cb3a0 dc2eb15 Author: Sam CorbettAuthored: Fri Mar 24 18:43:23 2017 + Committer: Sam Corbett Committed: Fri Mar 24 18:43:23 2017 + -- .../CompositeEffectorYamlRebindTest.java| 29 +- .../brooklyn/CompositeEffectorYamlTest.java | 27 +- .../HttpCommandEffectorYamlRebindTest.java | 29 +- .../brooklyn/HttpCommandEffectorYamlTest.java | 29 +- .../geo/external-ip-address-resolvers.txt | 5 +- .../http/HttpCommandEffectorHttpBinTest.java| 192 ++ .../HttpCommandEffectorIntegrationTest.java | 125 - .../brooklyn/policy/ha/ServiceReplacerTest.java | 16 +- ...rooklynJacksonSerializerIntegrationTest.java | 4 +- .../base/SoftwareProcessEntityTest.java | 10 +- .../lifecycle/ScriptHelperIntegrationTest.java | 53 +++- .../feed/windows/WinRmFeedIntegrationTest.java | 262 -- .../feed/windows/WinRmFeedLiveTest.java | 263 +++ 13 files changed, 624 insertions(+), 420 deletions(-) --
[3/6] brooklyn-server git commit: WinRmFeedIntegrationTest relies on an external resource, mark as Live
WinRmFeedIntegrationTest relies on an external resource, mark as Live Requires that the user spins up a windows machine and configures its location in his local brooklyn.properties. Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/f74ce8fc Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/f74ce8fc Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/f74ce8fc Branch: refs/heads/master Commit: f74ce8fc7c80d6cc3f2d2d97878d5faf4da7761d Parents: a682daa Author: Svetoslav NeykovAuthored: Fri Mar 24 12:17:04 2017 +0200 Committer: Svetoslav Neykov Committed: Fri Mar 24 12:56:14 2017 +0200 -- .../feed/windows/WinRmFeedIntegrationTest.java | 262 -- .../feed/windows/WinRmFeedLiveTest.java | 263 +++ 2 files changed, 263 insertions(+), 262 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/f74ce8fc/software/winrm/src/test/java/org/apache/brooklyn/feed/windows/WinRmFeedIntegrationTest.java -- diff --git a/software/winrm/src/test/java/org/apache/brooklyn/feed/windows/WinRmFeedIntegrationTest.java b/software/winrm/src/test/java/org/apache/brooklyn/feed/windows/WinRmFeedIntegrationTest.java deleted file mode 100644 index afaedb4..000 --- a/software/winrm/src/test/java/org/apache/brooklyn/feed/windows/WinRmFeedIntegrationTest.java +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.brooklyn.feed.windows; - -import com.google.common.base.Function; -import com.google.common.base.Predicates; -import com.google.common.base.Supplier; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import org.apache.brooklyn.api.entity.EntityInitializer; -import org.apache.brooklyn.api.entity.EntityLocal; -import org.apache.brooklyn.api.entity.EntitySpec; -import org.apache.brooklyn.api.location.MachineProvisioningLocation; -import org.apache.brooklyn.api.sensor.AttributeSensor; -import org.apache.brooklyn.core.entity.Attributes; -import org.apache.brooklyn.core.entity.EntityAsserts; -import org.apache.brooklyn.core.entity.EntityInternal; -import org.apache.brooklyn.core.entity.EntityInternal.FeedSupport; -import org.apache.brooklyn.core.sensor.Sensors; -import org.apache.brooklyn.core.test.BrooklynAppLiveTestSupport; -import org.apache.brooklyn.core.test.entity.TestEntity; -import org.apache.brooklyn.feed.CommandPollConfig; -import org.apache.brooklyn.feed.ssh.SshPollValue; -import org.apache.brooklyn.feed.ssh.SshValueFunctions; -import org.apache.brooklyn.location.winrm.WinRmMachineLocation; -import org.apache.brooklyn.util.collections.MutableMap; -import org.apache.brooklyn.util.exceptions.Exceptions; -import org.apache.brooklyn.util.text.StringFunctions; -import org.apache.brooklyn.util.text.StringPredicates; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.testng.Assert; -import org.testng.annotations.AfterMethod; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -import java.util.Map; -import java.util.concurrent.atomic.AtomicInteger; - -/** - * Test is almost identical to {@link org.apache.brooklyn.feed.ssh.SshFeedIntegrationTest}. - * To launch the test I put in ~/.brooklyn/brooklyn.properties - * brooklyn.location.named.WindowsLiveTest=byon:(hosts=192.168.1.2,osFamily=windows,user=winUser,password=p0ssw0rd) - */ -public class WinRmFeedIntegrationTest extends BrooklynAppLiveTestSupport { - -private static final Logger log = LoggerFactory.getLogger(WinRmFeedIntegrationTest.class); - -private static final String LOCATION_SPEC = "named:WindowsLiveTest"; - -final static AttributeSensor SENSOR_STRING = Sensors.newStringSensor("aString", ""); -final static AttributeSensor SENSOR_INT = Sensors.newIntegerSensor("aLong", ""); - -
[5/6] brooklyn-server git commit: SoftwareProcessEntityTest.testDoubleStopEntity - add some troubleshooting checks
SoftwareProcessEntityTest.testDoubleStopEntity - add some troubleshooting checks Failed with the following exception, but not obvious why: java.lang.AssertionError: entity=EmptySoftwareProcessImpl{id=i5jf7l77wu}; attribute=Sensor: service.state (org.apache.brooklyn.core.entity.lifecycle.Lifecycle) expected [stopped] but found [stopping] at org.apache.brooklyn.test.Asserts.fail(Asserts.java:758) at org.apache.brooklyn.test.Asserts.failNotEquals(Asserts.java:148) at org.apache.brooklyn.test.Asserts.assertEquals(Asserts.java:470) at org.apache.brooklyn.core.entity.EntityAsserts.assertAttributeEquals(EntityAsserts.java:58) at org.apache.brooklyn.entity.software.base.SoftwareProcessEntityTest.testDoubleStopEntity(SoftwareProcessEntityTest.java:496) Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/dc2eb153 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/dc2eb153 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/dc2eb153 Branch: refs/heads/master Commit: dc2eb153488bb3974db7f7707db2de69089c5c36 Parents: 363874e Author: Svetoslav NeykovAuthored: Fri Mar 24 17:19:55 2017 +0200 Committer: Svetoslav Neykov Committed: Fri Mar 24 17:19:55 2017 +0200 -- .../entity/software/base/SoftwareProcessEntityTest.java | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/dc2eb153/software/base/src/test/java/org/apache/brooklyn/entity/software/base/SoftwareProcessEntityTest.java -- diff --git a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/SoftwareProcessEntityTest.java b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/SoftwareProcessEntityTest.java index b1564e9..3fa464c 100644 --- a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/SoftwareProcessEntityTest.java +++ b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/SoftwareProcessEntityTest.java @@ -481,7 +481,10 @@ public class SoftwareProcessEntityTest extends BrooklynAppUnitTestSupport { assertTrue(loc.isBlocked()); } }); - + +assertEquals(ServiceStateLogic.getExpectedState(entity), Lifecycle.STOPPING); +EntityAsserts.assertAttributeEquals(entity, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.STOPPING); + // Subsequent stops will end quickly - no location to release, // while the first one is still releasing the machine. final Task secondStop = entity.invoke(Startable.STOP, ImmutableMap. of());; @@ -492,7 +495,10 @@ public class SoftwareProcessEntityTest extends BrooklynAppUnitTestSupport { } }); -// Entity state is STOPPED even though first location is still releasing +// Entity state is supposed to be STOPPED even though first location is still releasing. This is because the second +// release completed successfully. It's debatable whether this is the right behaviour - we could be calling the STOP +// effector exactly because the first call is blocked. The test is asserting the current behaviour. +assertEquals(ServiceStateLogic.getExpectedState(entity), Lifecycle.STOPPED); EntityAsserts.assertAttributeEquals(entity, Attributes.SERVICE_STATE_ACTUAL, Lifecycle.STOPPED); Asserts.succeedsContinually(new Runnable() { @Override
[1/6] brooklyn-server git commit: Replace http(s)://httpbin.org with a local server
Repository: brooklyn-server Updated Branches: refs/heads/master 23cb3a080 -> 05a86be47 Replace http(s)://httpbin.org with a local server Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/a682daa6 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/a682daa6 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/a682daa6 Branch: refs/heads/master Commit: a682daa65333587ac365dfa1d4a988d77bfbf5e4 Parents: 23cb3a0 Author: Svetoslav NeykovAuthored: Fri Mar 24 12:15:47 2017 +0200 Committer: Svetoslav Neykov Committed: Fri Mar 24 12:56:13 2017 +0200 -- .../CompositeEffectorYamlRebindTest.java| 29 ++- .../brooklyn/CompositeEffectorYamlTest.java | 27 ++- .../HttpCommandEffectorYamlRebindTest.java | 29 ++- .../brooklyn/HttpCommandEffectorYamlTest.java | 29 ++- .../http/HttpCommandEffectorHttpBinTest.java| 192 +++ .../HttpCommandEffectorIntegrationTest.java | 125 6 files changed, 295 insertions(+), 136 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a682daa6/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/CompositeEffectorYamlRebindTest.java -- diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/CompositeEffectorYamlRebindTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/CompositeEffectorYamlRebindTest.java index 530abf6..1f33c78 100644 --- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/CompositeEffectorYamlRebindTest.java +++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/CompositeEffectorYamlRebindTest.java @@ -27,10 +27,14 @@ import org.apache.brooklyn.api.effector.Effector; import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.core.effector.CompositeEffector; import org.apache.brooklyn.core.effector.http.HttpCommandEffector; +import org.apache.brooklyn.core.effector.http.HttpCommandEffectorHttpBinTest; import org.apache.brooklyn.core.entity.EntityPredicates; import org.apache.brooklyn.core.entity.StartableApplication; import org.apache.brooklyn.core.test.entity.TestEntity; +import org.apache.brooklyn.test.http.TestHttpServer; import org.apache.brooklyn.util.guava.Maybe; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import com.google.common.base.Joiner; @@ -57,7 +61,7 @@ public class CompositeEffectorYamlRebindTest extends AbstractYamlRebindTest { " brooklyn.config:", "name: myEffector", "description: myDescription", - "uri: http://httpbin.org/get?id=myId;, + "uri: ${serverUrl}/get?id=myId", "httpVerb: GET", "jsonPath: $.args.id", "publishSensor: results", @@ -69,9 +73,28 @@ public class CompositeEffectorYamlRebindTest extends AbstractYamlRebindTest { "- myEffector" ); -@Test(groups="Integration") + private TestHttpServer server; + private String serverUrl; + + @Override + @BeforeMethod(alwaysRun = true) + public void setUp() throws Exception { + super.setUp(); + server = HttpCommandEffectorHttpBinTest.createHttpBinServer(); + serverUrl = server.getUrl(); + } + + @Override + @AfterMethod(alwaysRun = true) + public void tearDown() throws Exception { + super.tearDown(); + server.stop(); + } + + + @Test public void testRebindWhenHealthy() throws Exception { - runRebindWhenIsUp(catalogYamlSimple, appVersionedId); + runRebindWhenIsUp(catalogYamlSimple.replace("${serverUrl}", serverUrl), appVersionedId); } protected void runRebindWhenIsUp(String catalogYaml, String appId) throws Exception { http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a682daa6/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/CompositeEffectorYamlTest.java -- diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/CompositeEffectorYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/CompositeEffectorYamlTest.java index 8d1ff0b..8833507 100644 --- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/CompositeEffectorYamlTest.java +++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/CompositeEffectorYamlTest.java @@ -26,9 +26,13 @@ import org.apache.brooklyn.api.effector.Effector;
[4/6] brooklyn-server git commit: Fixes integration tests
Fixes integration tests * One is a real problem - http://jsonip.com redirects to https://jsonip.com, which is signed by a certificate issued by "Let's Encrypt", not supported by java * The other changes the incorrect expectation in the test Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/363874e6 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/363874e6 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/363874e6 Branch: refs/heads/master Commit: 363874e6f8a2d0d25930f4bf00038d8fbad15a94 Parents: 32ccd24 Author: Svetoslav NeykovAuthored: Fri Mar 24 12:50:35 2017 +0200 Committer: Svetoslav Neykov Committed: Fri Mar 24 12:56:15 2017 +0200 -- .../brooklyn/location/geo/external-ip-address-resolvers.txt | 5 +++-- .../util/json/BrooklynJacksonSerializerIntegrationTest.java | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/363874e6/core/src/main/resources/org/apache/brooklyn/location/geo/external-ip-address-resolvers.txt -- diff --git a/core/src/main/resources/org/apache/brooklyn/location/geo/external-ip-address-resolvers.txt b/core/src/main/resources/org/apache/brooklyn/location/geo/external-ip-address-resolvers.txt index c51b394..f1cd8ab 100644 --- a/core/src/main/resources/org/apache/brooklyn/location/geo/external-ip-address-resolvers.txt +++ b/core/src/main/resources/org/apache/brooklyn/location/geo/external-ip-address-resolvers.txt @@ -15,10 +15,11 @@ # specific language governing permissions and limitations # under the License. -http://jsonip.com/ +# Uses Let's Encrypt certificate, not supported by current JRE (1.8.0_121-b13) +# https://jsonip.com/ http://myip.dnsomatic.com/ http://checkip.dyndns.org/ -# Uses Let's Encrypt certificate supported only in Java 8u101+ +# Uses Let's Encrypt certificate, not supported by current JRE (1.8.0_121-b13) # https://wtfismyip.com/text http://whatismyip.akamai.com/ http://myip.wampdeveloper.com/ http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/363874e6/rest/rest-server/src/test/java/org/apache/brooklyn/rest/util/json/BrooklynJacksonSerializerIntegrationTest.java -- diff --git a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/util/json/BrooklynJacksonSerializerIntegrationTest.java b/rest/rest-server/src/test/java/org/apache/brooklyn/rest/util/json/BrooklynJacksonSerializerIntegrationTest.java index edad261..4b016ed 100644 --- a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/util/json/BrooklynJacksonSerializerIntegrationTest.java +++ b/rest/rest-server/src/test/java/org/apache/brooklyn/rest/util/json/BrooklynJacksonSerializerIntegrationTest.java @@ -25,8 +25,8 @@ import java.util.Map; import javax.ws.rs.core.MediaType; import org.apache.brooklyn.api.entity.Entity; +import org.apache.brooklyn.api.mgmt.ManagementContext; import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport; -import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests; import org.apache.brooklyn.core.test.entity.TestApplication; import org.apache.brooklyn.core.test.entity.TestEntity; import org.apache.brooklyn.rest.BrooklynRestApiLauncher; @@ -103,7 +103,7 @@ public class BrooklynJacksonSerializerIntegrationTest extends BrooklynAppUnitTes public void testWithMgmt() throws Exception { setConfig(mgmt); Map values = getConfigValueAsJson(); -Assert.assertEquals(values, ImmutableMap.of("type", LocalManagementContextForTests.class.getCanonicalName()), "values="+values); +Assert.assertEquals(values, ImmutableMap.of("type", ManagementContext.class.getCanonicalName()), "values="+values); // assert normal API returns the same, containing links values = getRestValueAsJson(entityUrl);
[2/6] brooklyn-server git commit: Mark failing integration tests as Broken
Mark failing integration tests as Broken Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/32ccd248 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/32ccd248 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/32ccd248 Branch: refs/heads/master Commit: 32ccd248988c1f90cdde26aa23e6d8597c14a33d Parents: f74ce8f Author: Svetoslav NeykovAuthored: Fri Mar 24 12:49:25 2017 +0200 Committer: Svetoslav Neykov Committed: Fri Mar 24 12:56:14 2017 +0200 -- .../brooklyn/policy/ha/ServiceReplacerTest.java | 16 +- .../lifecycle/ScriptHelperIntegrationTest.java | 53 ++-- 2 files changed, 53 insertions(+), 16 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/32ccd248/policy/src/test/java/org/apache/brooklyn/policy/ha/ServiceReplacerTest.java -- diff --git a/policy/src/test/java/org/apache/brooklyn/policy/ha/ServiceReplacerTest.java b/policy/src/test/java/org/apache/brooklyn/policy/ha/ServiceReplacerTest.java index 4aead1a..9c17614 100644 --- a/policy/src/test/java/org/apache/brooklyn/policy/ha/ServiceReplacerTest.java +++ b/policy/src/test/java/org/apache/brooklyn/policy/ha/ServiceReplacerTest.java @@ -177,7 +177,19 @@ public class ServiceReplacerTest { assertEventuallyHasEntityReplacementFailedEvent(cluster); } -@Test(groups="Integration") // has a 1 second wait + +//Fails with: +//java.lang.AssertionError: Unexpected ON_FIRE state +//at org.testng.Assert.fail(Assert.java:94) +//at org.testng.Assert.assertNotEquals(Assert.java:832) +//at org.apache.brooklyn.policy.ha.ServiceReplacerTest$3.run(ServiceReplacerTest.java:204) +//at org.apache.brooklyn.test.Asserts$RunnableAdapter.call(Asserts.java:1359) +//at org.apache.brooklyn.test.Asserts.succeedsContinually(Asserts.java:1039) +//at org.apache.brooklyn.test.Asserts.succeedsContinually(Asserts.java:1018) +//at org.apache.brooklyn.test.Asserts.succeedsContinually(Asserts.java:1014) +//at org.apache.brooklyn.policy.ha.ServiceReplacerTest.testDoesNotOnFireWhenFailToReplaceMember(ServiceReplacerTest.java:214) +// +@Test(groups={"Integration", "Broken"}) // has a 1 second wait public void testDoesNotOnFireWhenFailToReplaceMember() throws Exception { app.subscriptions().subscribe(null, ServiceReplacer.ENTITY_REPLACEMENT_FAILED, eventListener); @@ -201,7 +213,7 @@ public class ServiceReplacerTest { // Configured to not mark cluster as on fire Asserts.succeedsContinually(new Runnable() { @Override public void run() { - assertNotEquals(cluster.getAttribute(Attributes.SERVICE_STATE_ACTUAL), Lifecycle.ON_FIRE); + assertNotEquals(cluster.getAttribute(Attributes.SERVICE_STATE_ACTUAL), Lifecycle.ON_FIRE, "Unexpected ON_FIRE state"); }}); // And will have received notification event about it http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/32ccd248/software/base/src/test/java/org/apache/brooklyn/entity/software/base/lifecycle/ScriptHelperIntegrationTest.java -- diff --git a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/lifecycle/ScriptHelperIntegrationTest.java b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/lifecycle/ScriptHelperIntegrationTest.java index 0566f39..0a1d4b2 100644 --- a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/lifecycle/ScriptHelperIntegrationTest.java +++ b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/lifecycle/ScriptHelperIntegrationTest.java @@ -18,11 +18,13 @@ */ package org.apache.brooklyn.entity.software.base.lifecycle; -import com.google.common.base.Joiner; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Iterables; -import org.apache.brooklyn.api.entity.EntityLocal; +import static java.lang.String.format; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertNotEquals; + +import java.io.StringReader; + import org.apache.brooklyn.api.entity.EntitySpec; import org.apache.brooklyn.api.location.Location; import org.apache.brooklyn.core.test.BrooklynAppLiveTestSupport; @@ -42,10 +44,10 @@ import org.slf4j.LoggerFactory; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import java.io.StringReader; - -import static
[1/2] brooklyn-dist git commit: docker-itest: java version to 8, add chef package
Repository: brooklyn-dist Updated Branches: refs/heads/master bd2e59174 -> d2cd2df96 docker-itest: java version to 8, add chef package Bump the java version to 8 in light of the projecft's decision to phase away Java 7 support. Install the chef package, needed by integration tests for the knife executable. Project: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/commit/0426c1eb Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/tree/0426c1eb Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/diff/0426c1eb Branch: refs/heads/master Commit: 0426c1eb21c74a9ffd594c7672d5964ceebc2746 Parents: bd2e591 Author: Svetoslav NeykovAuthored: Fri Mar 24 19:41:06 2017 +0200 Committer: Svetoslav Neykov Committed: Fri Mar 24 19:41:06 2017 +0200 -- docker-itest/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/0426c1eb/docker-itest/Dockerfile -- diff --git a/docker-itest/Dockerfile b/docker-itest/Dockerfile index b8bfbe9..d50d7fa 100644 --- a/docker-itest/Dockerfile +++ b/docker-itest/Dockerfile @@ -16,7 +16,7 @@ # under the License. # -FROM maven:3.3.9-jdk-7 +FROM maven:3.3-jdk-8 MAINTAINER Svetoslav Neykov "svetoslav.ney...@cloudsoft.io" # For Alpine: @@ -28,7 +28,7 @@ MAINTAINER Svetoslav Neykov "svetoslav.ney...@cloudsoft.io" # because of differences in the accepted arguments of the busybox provided tools. RUN apt-get update && \ -apt-get install -y --no-install-recommends net-tools ssh sudo wget && \ +DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends net-tools ssh sudo wget chef && \ rm -rf /var/lib/apt/lists/* RUN mkdir /etc/skel/.m2 && \ echo "" > /etc/skel/.m2/settings.xml && \
[2/2] brooklyn-dist git commit: This closes #88
This closes #88 docker-itest: java version to 8, add chef package Project: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/commit/d2cd2df9 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/tree/d2cd2df9 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/diff/d2cd2df9 Branch: refs/heads/master Commit: d2cd2df967bfa6b0f6b24ff1ee63c90e80168e68 Parents: bd2e591 0426c1e Author: Sam CorbettAuthored: Fri Mar 24 18:40:16 2017 + Committer: Sam Corbett Committed: Fri Mar 24 18:40:16 2017 + -- docker-itest/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --
[1/2] brooklyn-library git commit: Add entity/config test via REST using redis as an example
Repository: brooklyn-library Updated Branches: refs/heads/master d7bf15951 -> 3715b9904 Add entity/config test via REST using redis as an example Move the test by @sjcorbett added to brooklyn-server in d7cbaeed46d7fedf8e49df015baa812352060f45 here so it can use library items, as discussed in https://github.com/apache/brooklyn-server/pull/594 Project: http://git-wip-us.apache.org/repos/asf/brooklyn-library/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-library/commit/4a31ea74 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-library/tree/4a31ea74 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-library/diff/4a31ea74 Branch: refs/heads/master Commit: 4a31ea74f15cd191359d326e1440b5f3b55349ca Parents: d7bf159 Author: Alex Heneveld <alex.henev...@cloudsoftcorp.com> Authored: Fri Mar 17 10:52:05 2017 + Committer: Alex Heneveld <alex.henev...@cloudsoftcorp.com> Committed: Fri Mar 17 11:05:43 2017 + -- qa/pom.xml | 13 +++ .../RedisClusterViaRestIntegrationTest.java | 111 +++ 2 files changed, 124 insertions(+) -- http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/4a31ea74/qa/pom.xml -- diff --git a/qa/pom.xml b/qa/pom.xml index cbef5e6..f79e530 100644 --- a/qa/pom.xml +++ b/qa/pom.xml @@ -55,6 +55,19 @@ ${project.version} +org.apache.brooklyn +brooklyn-rest-server +${project.version} +tests +test + + +org.apache.brooklyn +brooklyn-software-nosql +${project.version} +test + + net.sf.jopt-simple jopt-simple http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/4a31ea74/qa/src/test/java/org/apache/brooklyn/qa/nosql/RedisClusterViaRestIntegrationTest.java -- diff --git a/qa/src/test/java/org/apache/brooklyn/qa/nosql/RedisClusterViaRestIntegrationTest.java b/qa/src/test/java/org/apache/brooklyn/qa/nosql/RedisClusterViaRestIntegrationTest.java new file mode 100644 index 000..6b75bde --- /dev/null +++ b/qa/src/test/java/org/apache/brooklyn/qa/nosql/RedisClusterViaRestIntegrationTest.java @@ -0,0 +1,111 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.apache.brooklyn.qa.nosql; + +import static org.apache.brooklyn.test.Asserts.assertTrue; +import static org.testng.Assert.assertNotNull; + +import java.net.URI; +import java.util.Map; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeoutException; + +import org.apache.brooklyn.api.entity.Entity; +import org.apache.brooklyn.api.entity.EntitySpec; +import org.apache.brooklyn.api.mgmt.ManagementContext; +import org.apache.brooklyn.api.mgmt.Task; +import org.apache.brooklyn.core.entity.Attributes; +import org.apache.brooklyn.core.entity.Entities; +import org.apache.brooklyn.core.entity.EntityAsserts; +import org.apache.brooklyn.entity.brooklynnode.BrooklynNode; +import org.apache.brooklyn.entity.nosql.redis.RedisCluster; +import org.apache.brooklyn.entity.nosql.redis.RedisStore; +import org.apache.brooklyn.entity.software.base.SoftwareProcess; +import org.apache.brooklyn.rest.BrooklynRestApiLauncherTestFixture; +import org.apache.brooklyn.util.http.HttpAsserts; +import org.apache.brooklyn.util.http.HttpToolResponse; +import org.apache.brooklyn.util.text.Strings; +import org.apache.brooklyn.util.time.Duration; +import org.apache.brooklyn.util.yaml.Yamls; +import org.testng.Assert; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableMap; + +public class RedisClusterViaRestIntegrationTest extends BrooklynRestApiLauncherTestFixture { + +@BeforeMethod(alwaysRun=true) +public void setUp() throws Exception { +useServerForTest(newServer()); +
[2/2] brooklyn-library git commit: This closes #94
This closes #94 Add entity/config test via REST using redis as an example Project: http://git-wip-us.apache.org/repos/asf/brooklyn-library/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-library/commit/3715b990 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-library/tree/3715b990 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-library/diff/3715b990 Branch: refs/heads/master Commit: 3715b990448b07899e2f0da2f153b2253de10b61 Parents: d7bf159 4a31ea7 Author: Sam CorbettAuthored: Tue Mar 21 17:47:05 2017 + Committer: Sam Corbett Committed: Tue Mar 21 17:47:05 2017 + -- qa/pom.xml | 13 +++ .../RedisClusterViaRestIntegrationTest.java | 111 +++ 2 files changed, 124 insertions(+) --
[3/3] brooklyn-server git commit: This closes #582
This closes #582 Fix Integration tests Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/f218966f Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/f218966f Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/f218966f Branch: refs/heads/master Commit: f218966fef0f7964df4e2e6ce873df7243f309e4 Parents: ea18d9a 3cef896 Author: Sam CorbettAuthored: Mon Mar 13 11:30:33 2017 + Committer: Sam Corbett Committed: Mon Mar 13 11:30:33 2017 + -- .../location/jclouds/BailOutJcloudsLocation.java| 12 +--- .../entitlement/AbstractRestApiEntitlementsTest.java| 7 +++ .../lifecycle/MachineLifecycleEffectorTasksTest.java| 11 --- 3 files changed, 20 insertions(+), 10 deletions(-) --
[1/3] brooklyn-server git commit: Fix Entitlements Integration tests
Repository: brooklyn-server Updated Branches: refs/heads/master ea18d9ab0 -> f218966fe Fix Entitlements Integration tests Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/09f8332f Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/09f8332f Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/09f8332f Branch: refs/heads/master Commit: 09f8332fe5c496e7194ff59e2c77bc0870a2fe74 Parents: 2fe2ba0 Author: Svetoslav NeykovAuthored: Tue Mar 7 19:22:12 2017 +0200 Committer: Svetoslav Neykov Committed: Tue Mar 7 23:30:41 2017 +0200 -- .../rest/entitlement/AbstractRestApiEntitlementsTest.java | 7 +++ 1 file changed, 7 insertions(+) -- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/09f8332f/rest/rest-server/src/test/java/org/apache/brooklyn/rest/entitlement/AbstractRestApiEntitlementsTest.java -- diff --git a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/entitlement/AbstractRestApiEntitlementsTest.java b/rest/rest-server/src/test/java/org/apache/brooklyn/rest/entitlement/AbstractRestApiEntitlementsTest.java index 7e11474..67b0e8b 100644 --- a/rest/rest-server/src/test/java/org/apache/brooklyn/rest/entitlement/AbstractRestApiEntitlementsTest.java +++ b/rest/rest-server/src/test/java/org/apache/brooklyn/rest/entitlement/AbstractRestApiEntitlementsTest.java @@ -19,6 +19,7 @@ package org.apache.brooklyn.rest.entitlement; import static org.testng.Assert.assertEquals; + import java.net.URI; import org.apache.brooklyn.api.entity.EntitySpec; @@ -30,6 +31,7 @@ import org.apache.brooklyn.core.mgmt.entitlement.PerUserEntitlementManager; import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests; import org.apache.brooklyn.core.test.entity.TestApplication; import org.apache.brooklyn.core.test.entity.TestEntity; +import org.apache.brooklyn.rest.BrooklynRestApiLauncher; import org.apache.brooklyn.rest.BrooklynRestApiLauncherTestFixture; import org.apache.brooklyn.rest.BrooklynWebConfig; import org.apache.brooklyn.util.http.HttpTool; @@ -72,6 +74,11 @@ public abstract class AbstractRestApiEntitlementsTest extends BrooklynRestApiLau .start()); } +@Override +protected BrooklynRestApiLauncher baseLauncher() { +return BrooklynRestApiLauncher.launcher(); +} + @AfterMethod(alwaysRun=true) public void tearDown() throws Exception { if (mgmt != null) Entities.destroyAll(mgmt);
[2/2] brooklyn-ui git commit: This closes #36
This closes #36 Updated logout step to work in karaf mode Project: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/commit/d9b82dff Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/tree/d9b82dff Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/diff/d9b82dff Branch: refs/heads/master Commit: d9b82dffbb6457fb38e276129db6227e7576 Parents: 9c2d7f7 f79b98a Author: Sam CorbettAuthored: Mon Mar 6 14:11:16 2017 + Committer: Sam Corbett Committed: Mon Mar 6 14:11:16 2017 + -- src/main/webapp/assets/html/swagger-ui.html | 18 +++-- src/main/webapp/assets/js/logout.js | 79 .../webapp/assets/js/util/brooklyn-utils.js | 13 +--- src/main/webapp/logout.html | 55 ++ src/main/webapp/logout_redirect.html| 33 5 files changed, 146 insertions(+), 52 deletions(-) --
[1/2] brooklyn-ui git commit: Updated logout step to work in karaf mode
Repository: brooklyn-ui Updated Branches: refs/heads/master 9c2d7f706 -> d9b82dffb Updated logout step to work in karaf mode - BROOKLYN-323: Simplify LogoutApi - relative urls for swagger html Project: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/commit/f79b98a3 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/tree/f79b98a3 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/diff/f79b98a3 Branch: refs/heads/master Commit: f79b98a368016a1b8d1fd5bae6be46e8c3cb64a8 Parents: 9c2d7f7 Author: Valentin AitkenAuthored: Wed Nov 9 13:15:40 2016 +0200 Committer: Valentin Aitken Committed: Fri Mar 3 19:16:27 2017 +0200 -- src/main/webapp/assets/html/swagger-ui.html | 18 +++-- src/main/webapp/assets/js/logout.js | 79 .../webapp/assets/js/util/brooklyn-utils.js | 13 +--- src/main/webapp/logout.html | 55 ++ src/main/webapp/logout_redirect.html| 33 5 files changed, 146 insertions(+), 52 deletions(-) -- http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/f79b98a3/src/main/webapp/assets/html/swagger-ui.html -- diff --git a/src/main/webapp/assets/html/swagger-ui.html b/src/main/webapp/assets/html/swagger-ui.html index e3f307f..79bd073 100644 --- a/src/main/webapp/assets/html/swagger-ui.html +++ b/src/main/webapp/assets/html/swagger-ui.html @@ -40,6 +40,8 @@ + + $(function () { @@ -86,20 +88,20 @@