Skip to content

Commit

Permalink
Merge pull request #10 from gcheng/dev-private
Browse files Browse the repository at this point in the history
Internationalize the service bus for the dev-private branch.
  • Loading branch information
Albert Cheng committed Aug 1, 2012
2 parents e9830c4 + 333e2f3 commit 3a646ab
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
* Copyright 2011 Microsoft Corporation
*
* Licensed 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
* 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.
* 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 com.microsoft.windowsazure.services.serviceBus;

Expand Down Expand Up @@ -63,8 +63,10 @@ public class ServiceBusConfiguration {
* <code>ServiceBusService</code> class.
*
*/
public static Configuration configureWithWrapAuthentication(String namespace, String authenticationName, String authenticationPassword) {
return configureWithWrapAuthentication(null, Configuration.getInstance(), namespace, authenticationName, authenticationPassword);
public static Configuration configureWithWrapAuthentication(String namespace, String authenticationName,
String authenticationPassword, String serviceBusRootUri, String wrapRootUri) {
return configureWithWrapAuthentication(null, Configuration.getInstance(), namespace, authenticationName,
authenticationPassword, serviceBusRootUri, wrapRootUri);
}

/**
Expand All @@ -87,9 +89,10 @@ public static Configuration configureWithWrapAuthentication(String namespace, St
* <code>ServiceBusService</code> class.
*
*/
public static Configuration configureWithWrapAuthentication(Configuration configuration, String namespace, String authenticationName,
String authenticationPassword) {
return configureWithWrapAuthentication(null, configuration, namespace, authenticationName, authenticationPassword);
public static Configuration configureWithWrapAuthentication(Configuration configuration, String namespace,
String authenticationName, String authenticationPassword, String serviceBusRootUri, String wrapRootUri) {
return configureWithWrapAuthentication(null, configuration, namespace, authenticationName,
authenticationPassword, serviceBusRootUri, wrapRootUri);
}

/**
Expand All @@ -115,8 +118,9 @@ public static Configuration configureWithWrapAuthentication(Configuration config
* <code>ServiceBusService</code> class.
*
*/
public static Configuration configureWithWrapAuthentication(String profile, Configuration configuration, String namespace,
String authenticationName, String authenticationPassword) {
public static Configuration configureWithWrapAuthentication(String profile, Configuration configuration,
String namespace, String authenticationName, String authenticationPassword, String serviceBusRootUri,
String wrapRootUri) {

if (profile == null) {
profile = "";
Expand All @@ -125,10 +129,9 @@ else if (profile.length() != 0 && !profile.endsWith(".")) {
profile = profile + ".";
}

configuration.setProperty(profile + URI, "https://" + namespace + ".servicebus.windows.net/");
configuration.setProperty(profile + URI, "https://" + namespace + serviceBusRootUri);

configuration
.setProperty(profile + WRAP_URI, "https://" + namespace + "-sb.accesscontrol.windows.net/WRAPv0.9");
configuration.setProperty(profile + WRAP_URI, "https://" + namespace + wrapRootUri);

configuration.setProperty(profile + WRAP_NAME, authenticationName);
configuration.setProperty(profile + WRAP_PASSWORD, authenticationPassword);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
* Copyright 2011 Microsoft Corporation
*
* Licensed 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
* 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.
* 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 com.microsoft.windowsazure.services.serviceBus;

Expand All @@ -27,7 +27,8 @@ public void ConfigureSetsExpectedProperties() {
Configuration config = new Configuration();

// Act
ServiceBusConfiguration.configureWithWrapAuthentication(config, "alpha", "beta", "gamma");
ServiceBusConfiguration.configureWithWrapAuthentication(config, "alpha", "beta", "gamma",
".servicebus.windows.net/", "-sb.accesscontrol.windows.net/WRAPv0.9");

// Assert
assertEquals("https://alpha.servicebus.windows.net/", config.getProperty("serviceBus.uri"));
Expand All @@ -42,7 +43,8 @@ public void UsingProfileAddsPrefix() {
Configuration config = new Configuration();

// Act
ServiceBusConfiguration.configureWithWrapAuthentication("backup", config, "alpha", "beta", "gamma");
ServiceBusConfiguration.configureWithWrapAuthentication("backup", config, "alpha", "beta", "gamma",
".servicebus.windows.net/", "-sb.accesscontrol.windows.net/WRAPv0.9");

// Assert
assertEquals("https://alpha.servicebus.windows.net/", config.getProperty("backup.serviceBus.uri"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
* Copyright 2011 Microsoft Corporation
*
* Licensed 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
* 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.
* 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 com.microsoft.windowsazure.services.serviceBus;

Expand All @@ -24,7 +24,8 @@
public class ServiceBusCreationTest {
@Test
public void theServiceClassMayBeCreatedDirectlyViaSingletonConfig() throws Exception {
ServiceBusConfiguration.configureWithWrapAuthentication("my-namespace", "my-identity", "my-shared-secret");
ServiceBusConfiguration.configureWithWrapAuthentication("my-namespace", "my-identity", "my-shared-secret",
".servicebus.windows.net", "-sb.accesscontrol.windows.net/WRAPv0.9");
ServiceBusContract service = ServiceBusService.create();

assertNotNull(service);
Expand All @@ -33,7 +34,8 @@ public void theServiceClassMayBeCreatedDirectlyViaSingletonConfig() throws Excep

public Configuration newConfiguration() {
Configuration config = new Configuration();
ServiceBusConfiguration.configureWithWrapAuthentication(config, "my-namespace", "my-identity", "my-shared-secret");
ServiceBusConfiguration.configureWithWrapAuthentication(config, "my-namespace", "my-identity",
"my-shared-secret", ".servicebus.windows.net", "-sb.accesscontrol.windows.net/WRAPv0.9");
return config;
}

Expand Down

0 comments on commit 3a646ab

Please sign in to comment.