From 686f91cc5c7525d32b30b01eb5d05aab64164aef Mon Sep 17 00:00:00 2001 From: "Jason Cooke (MSFT)" Date: Mon, 28 Jan 2013 14:12:30 -0800 Subject: [PATCH 1/8] Minor changes to address the compile-time warnings --- .../core/utils/ServiceExceptionFactory.java | 2 +- .../implementation/BrokerProperties.java | 20 ++++++------ .../services/table/client/TableQuery.java | 4 +++ .../table/implementation/TableRestProxy.java | 4 +++ .../queue/client/CloudQueueClientTests.java | 32 ++++++++++++++----- .../queue/client/CloudQueueTests.java | 8 +++-- .../serviceBus/ServiceBusIntegrationTest.java | 2 +- 7 files changed, 50 insertions(+), 22 deletions(-) diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/ServiceExceptionFactory.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/ServiceExceptionFactory.java index 2efac14c00b0..2d7a029c30c7 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/ServiceExceptionFactory.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/ServiceExceptionFactory.java @@ -28,7 +28,7 @@ public static ServiceException process(String serviceName, ServiceException exce Throwable cause = exception.getCause(); for (Throwable scan = cause; scan != null; scan = scan.getCause()) { - Class scanClass = scan.getClass(); + Class scanClass = scan.getClass(); if (ServiceException.class.isAssignableFrom(scanClass)) { return populate(exception, serviceName, (ServiceException) scan); } diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/BrokerProperties.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/BrokerProperties.java index 2db84273def9..e67717853055 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/BrokerProperties.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/BrokerProperties.java @@ -2,15 +2,15 @@ * Copyright 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.implementation; @@ -19,7 +19,7 @@ import org.codehaus.jackson.annotate.JsonIgnore; import org.codehaus.jackson.annotate.JsonIgnoreProperties; import org.codehaus.jackson.annotate.JsonProperty; -import org.codehaus.jackson.annotate.JsonWriteNullProperties; +import org.codehaus.jackson.map.annotate.JsonSerialize; // // members of this class defined per specification at @@ -27,7 +27,7 @@ // @JsonIgnoreProperties(ignoreUnknown = true) -@JsonWriteNullProperties(false) +@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL) public class BrokerProperties { @JsonProperty("CorrelationId") diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableQuery.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableQuery.java index 6b5e12695101..924ab0fead22 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableQuery.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableQuery.java @@ -202,6 +202,8 @@ public static String generateFilterCondition(String propertyName, String operati for (byte b : value) { formatter.format("%02x", b); } + formatter.flush(); + formatter.close(); return generateFilterCondition(propertyName, operation, sb.toString(), EdmType.BINARY); } @@ -232,6 +234,8 @@ public static String generateFilterCondition(String propertyName, String operati for (byte b : value) { formatter.format("%02x", b); } + formatter.flush(); + formatter.close(); return generateFilterCondition(propertyName, operation, sb.toString(), EdmType.BINARY); } diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/TableRestProxy.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/TableRestProxy.java index 72379bb2582b..193f2305b199 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/TableRestProxy.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/TableRestProxy.java @@ -257,6 +257,8 @@ else if (value.getClass() == byte[].class) { for (byte b : byteArray) { formatter.format("%02x", b); } + formatter.flush(); + formatter.close(); sb.append("'"); } else if (value.getClass() == Byte[].class) { @@ -266,6 +268,8 @@ else if (value.getClass() == Byte[].class) { for (Byte b : byteArray) { formatter.format("%02x", b); } + formatter.flush(); + formatter.close(); sb.append("'"); } else { diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/CloudQueueClientTests.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/CloudQueueClientTests.java index b3c266fac5ae..0d560e3f9ef2 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/CloudQueueClientTests.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/CloudQueueClientTests.java @@ -67,7 +67,9 @@ public void testListQueuesSmallNumber() throws URISyntaxException, StorageExcept int initialCount = 0; for (CloudQueue queue : qClient.listQueues()) { - initialCount++; + if (queue != null) { + initialCount++; + } } HashMap metadata1 = new HashMap(); @@ -82,7 +84,9 @@ public void testListQueuesSmallNumber() throws URISyntaxException, StorageExcept int count = 0; for (CloudQueue queue : qClient.listQueues()) { - count++; + if (queue != null) { + count++; + } } Assert.assertEquals(count, initialCount + 25); @@ -99,7 +103,9 @@ public void testListQueuesSmallNumber() throws URISyntaxException, StorageExcept count = 0; for (CloudQueue queue : qClient.listQueues(perfix, QueueListingDetails.METADATA, null, null)) { - count++; + if (queue != null) { + count++; + } Assert.assertTrue(queue.getMetadata().size() == 1 && queue.getMetadata().get("tags").equals(queue.getName())); } @@ -111,7 +117,9 @@ public void testListQueuesSmallNumber() throws URISyntaxException, StorageExcept public void testListQueuesAndListQueuesSegmentedLargeNumber() throws URISyntaxException, StorageException { int count = 0; for (CloudQueue queue : qClient.listQueues()) { - count++; + if (queue != null) { + count++; + } } int totalLimit = 5005; @@ -130,7 +138,9 @@ public void testListQueuesAndListQueuesSegmentedLargeNumber() throws URISyntaxEx count = 0; for (CloudQueue queue : qClient.listQueues()) { - count++; + if (queue != null) { + count++; + } } } @@ -181,17 +191,23 @@ public void testListQueuesSegmented() throws URISyntaxException, StorageExceptio public void testListQueuesEqual() throws URISyntaxException, StorageException { int count1 = 0; for (CloudQueue queue : qClient.listQueues()) { - count1++; + if (queue != null) { + count1++; + } } int count2 = 0; for (CloudQueue queue : qClient.listQueues("")) { - count2++; + if (queue != null) { + count2++; + } } int count3 = 0; for (CloudQueue queue : qClient.listQueues(null)) { - count3++; + if (queue != null) { + count3++; + } } Assert.assertEquals(count1, count2); diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/CloudQueueTests.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/CloudQueueTests.java index d97bb4bdc7b4..bf9b428d9fa8 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/CloudQueueTests.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/CloudQueueTests.java @@ -487,7 +487,9 @@ public void testClearMessages() throws URISyntaxException, StorageException, Uns int count = 0; for (CloudQueueMessage m : queue.peekMessages(32)) { - count++; + if (m != null) { + count++; + } } Assert.assertTrue(count == 2); @@ -498,7 +500,9 @@ public void testClearMessages() throws URISyntaxException, StorageException, Uns count = 0; for (CloudQueueMessage m : queue.peekMessages(32)) { - count++; + if (m != null) { + count++; + } } Assert.assertTrue(count == 0); diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusIntegrationTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusIntegrationTest.java index bd86d9b7abf9..c09af13305b8 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusIntegrationTest.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusIntegrationTest.java @@ -128,7 +128,7 @@ public void getNonExistQueueFail() throws Exception { String queuePath = "testGetNonExistQueueFail"; // Act - GetQueueResult getQueueResult = service.getQueue(queuePath); + service.getQueue(queuePath); // Assert } From 9c2243ab9e1a2ccfa45e7b2ebfbcf77fcc3f8e13 Mon Sep 17 00:00:00 2001 From: "Jason Cooke (MSFT)" Date: Tue, 29 Jan 2013 09:15:31 -0800 Subject: [PATCH 2/8] Remove trivial TODO comments from tests --- .../Protocol1RuntimeGoalStateClientTests.java | 24 +++++++++---------- .../queue/client/CloudQueueTests.java | 4 ---- .../table/client/TableQueryTests.java | 1 - 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/serviceruntime/Protocol1RuntimeGoalStateClientTests.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/serviceruntime/Protocol1RuntimeGoalStateClientTests.java index 42f4d4acab31..00a669a080ff 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/serviceruntime/Protocol1RuntimeGoalStateClientTests.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/serviceruntime/Protocol1RuntimeGoalStateClientTests.java @@ -2,25 +2,26 @@ * Copyright 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.serviceruntime; +import static org.hamcrest.Matchers.*; +import static org.junit.Assert.*; + import java.io.InputStream; import java.util.LinkedList; import java.util.List; import org.junit.Test; -import static org.junit.Assert.*; -import static org.hamcrest.Matchers.*; /** * @@ -88,7 +89,7 @@ public void goalStateClientRestartsThread() { Protocol1RuntimeCurrentStateClient currentStateClient = new Protocol1RuntimeCurrentStateClient(null, null); GoalStateDeserializer goalStateDeserializer = new GoalStateDeserializer() { - private ChunkedGoalStateDeserializer deserializer = new ChunkedGoalStateDeserializer(); + private final ChunkedGoalStateDeserializer deserializer = new ChunkedGoalStateDeserializer(); @Override public void initialize(InputStream inputStream) { @@ -148,7 +149,6 @@ public RoleEnvironmentData deserialize(InputStream stream) { client.getCurrentGoalState(); } catch (InterruptedException e) { - // TODO Auto-generated catch block e.printStackTrace(); } diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/CloudQueueTests.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/CloudQueueTests.java index bf9b428d9fa8..543b0b382cd3 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/CloudQueueTests.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/CloudQueueTests.java @@ -691,7 +691,6 @@ public void testAddMessageWithVisibilityTimeout() throws URISyntaxException, Sto Thread.sleep(2000); } catch (InterruptedException e) { - // TODO Auto-generated catch block e.printStackTrace(); } @@ -841,7 +840,6 @@ public void testRetrieveMessage() throws URISyntaxException, StorageException, U Thread.sleep(2000); } catch (InterruptedException e) { - // TODO Auto-generated catch block e.printStackTrace(); } @@ -934,7 +932,6 @@ public void testDequeueCountIncreases() throws URISyntaxException, StorageExcept Thread.sleep(2000); } catch (InterruptedException e) { - // TODO Auto-generated catch block e.printStackTrace(); } @@ -1170,7 +1167,6 @@ public void testUpdateMessageFullPass() throws URISyntaxException, StorageExcept Thread.sleep(2000); } catch (InterruptedException e) { - // TODO Auto-generated catch block e.printStackTrace(); } diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableQueryTests.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableQueryTests.java index 7bec262714c0..8023517879ac 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableQueryTests.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableQueryTests.java @@ -364,7 +364,6 @@ public void testQueryOnSupportedTypes() throws StorageException { Thread.sleep(100); } catch (InterruptedException e) { - // TODO Auto-generated catch block e.printStackTrace(); } batch.insert(ent); From b375ecb1bb4a899c289ac7527d7a7556bd2341b6 Mon Sep 17 00:00:00 2001 From: "Jason Cooke (MSFT)" Date: Tue, 29 Jan 2013 09:19:28 -0800 Subject: [PATCH 3/8] Removing trivial TODO Auto-generated comments --- .../serviceruntime/RoleEnvironment.java | 18 ++++++------ .../BrokerPropertiesMapper.java | 28 ++++++------------- .../implementation/MarshallerProvider.java | 23 ++++++--------- .../table/implementation/SharedKeyFilter.java | 2 -- 4 files changed, 26 insertions(+), 45 deletions(-) diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironment.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironment.java index 5d8f04727b04..e5e3e865f67c 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironment.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironment.java @@ -2,15 +2,15 @@ * Copyright 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.serviceruntime; @@ -50,7 +50,6 @@ public final class RoleEnvironment { JAXBContext.newInstance(RoleEnvironment.class.getPackage().getName()); } catch (JAXBException e) { - // TODO Auto-generated catch block e.printStackTrace(); } clientId = UUID.randomUUID().toString(); @@ -93,6 +92,7 @@ private static synchronized void initialize() { lastState = new AtomicReference(); runtimeClient.addGoalStateChangedListener(new GoalStateChangedListener() { + @Override public void goalStateChanged(GoalState newGoalState) { switch (newGoalState.getExpectedState()) { case STARTED: diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/BrokerPropertiesMapper.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/BrokerPropertiesMapper.java index 5a8dda45f9ba..a01aa2aed43b 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/BrokerPropertiesMapper.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/BrokerPropertiesMapper.java @@ -2,15 +2,15 @@ * Copyright 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.implementation; @@ -31,18 +31,12 @@ public BrokerProperties fromString(String value) throws IllegalArgumentException return mapper.readValue(value.getBytes(), BrokerProperties.class); } catch (JsonParseException e) { - // TODO Auto-generated catch block - e.printStackTrace(); throw new IllegalArgumentException(e); } catch (JsonMappingException e) { - // TODO Auto-generated catch block - e.printStackTrace(); throw new IllegalArgumentException(e); } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); throw new IllegalArgumentException(e); } } @@ -54,18 +48,12 @@ public String toString(BrokerProperties value) { mapper.writeValue(writer, value); } catch (JsonGenerationException e) { - // TODO Auto-generated catch block - e.printStackTrace(); throw new RuntimeException(e); } catch (JsonMappingException e) { - // TODO Auto-generated catch block - e.printStackTrace(); throw new RuntimeException(e); } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); throw new RuntimeException(e); } return writer.toString(); diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/MarshallerProvider.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/MarshallerProvider.java index fbda9c3f7f5e..3edfc51d87c2 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/MarshallerProvider.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/MarshallerProvider.java @@ -2,15 +2,15 @@ * Copyright 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.implementation; @@ -30,19 +30,16 @@ public class MarshallerProvider implements ContextResolver { @Context private ContextResolver jaxbContextResolver; + @Override public Marshaller getContext(Class type) { Marshaller marshaller; try { marshaller = getJAXBContext(type).createMarshaller(); } catch (JAXBException e) { - // TODO Auto-generated catch block - e.printStackTrace(); return null; } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); return null; } com.sun.xml.bind.marshaller.NamespacePrefixMapper mapper = new NamespacePrefixMapperImpl(); @@ -50,8 +47,6 @@ public Marshaller getContext(Class type) { marshaller.setProperty("com.sun.xml.bind.namespacePrefixMapper", mapper); } catch (PropertyException e) { - // TODO Auto-generated catch block - e.printStackTrace(); return null; } return marshaller; diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/SharedKeyFilter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/SharedKeyFilter.java index d14843554216..352115a45dba 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/SharedKeyFilter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/SharedKeyFilter.java @@ -55,8 +55,6 @@ public void sign(ClientRequest cr) { if (log.isDebugEnabled()) { log.debug(String.format("String to sign: \"%s\"", stringToSign)); } - //TODO: Remove or comment the following line - //System.out.println(String.format("String to sign: \"%s\"", stringToSign)); String signature = this.getSigner().sign(stringToSign); cr.getHeaders().putSingle("Authorization", "SharedKey " + this.getAccountName() + ":" + signature); From 2d0299f84dd8623107c8a7e5c70d17451ac1d279 Mon Sep 17 00:00:00 2001 From: "Jason Cooke (MSFT)" Date: Tue, 29 Jan 2013 10:32:33 -0800 Subject: [PATCH 4/8] Replace trivial *if* statement with more useful Assert --- .../queue/client/CloudQueueClientTests.java | 39 +++++++------------ .../queue/client/CloudQueueTests.java | 10 ++--- 2 files changed, 19 insertions(+), 30 deletions(-) diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/CloudQueueClientTests.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/CloudQueueClientTests.java index 0d560e3f9ef2..fd3a57a7f1f1 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/CloudQueueClientTests.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/CloudQueueClientTests.java @@ -67,9 +67,8 @@ public void testListQueuesSmallNumber() throws URISyntaxException, StorageExcept int initialCount = 0; for (CloudQueue queue : qClient.listQueues()) { - if (queue != null) { - initialCount++; - } + Assert.assertNotNull(queue); + initialCount++; } HashMap metadata1 = new HashMap(); @@ -84,9 +83,8 @@ public void testListQueuesSmallNumber() throws URISyntaxException, StorageExcept int count = 0; for (CloudQueue queue : qClient.listQueues()) { - if (queue != null) { - count++; - } + Assert.assertNotNull(queue); + count++; } Assert.assertEquals(count, initialCount + 25); @@ -103,9 +101,7 @@ public void testListQueuesSmallNumber() throws URISyntaxException, StorageExcept count = 0; for (CloudQueue queue : qClient.listQueues(perfix, QueueListingDetails.METADATA, null, null)) { - if (queue != null) { - count++; - } + count++; Assert.assertTrue(queue.getMetadata().size() == 1 && queue.getMetadata().get("tags").equals(queue.getName())); } @@ -117,9 +113,8 @@ public void testListQueuesSmallNumber() throws URISyntaxException, StorageExcept public void testListQueuesAndListQueuesSegmentedLargeNumber() throws URISyntaxException, StorageException { int count = 0; for (CloudQueue queue : qClient.listQueues()) { - if (queue != null) { - count++; - } + Assert.assertNotNull(queue); + count++; } int totalLimit = 5005; @@ -138,9 +133,8 @@ public void testListQueuesAndListQueuesSegmentedLargeNumber() throws URISyntaxEx count = 0; for (CloudQueue queue : qClient.listQueues()) { - if (queue != null) { - count++; - } + Assert.assertNotNull(queue); + count++; } } @@ -191,23 +185,20 @@ public void testListQueuesSegmented() throws URISyntaxException, StorageExceptio public void testListQueuesEqual() throws URISyntaxException, StorageException { int count1 = 0; for (CloudQueue queue : qClient.listQueues()) { - if (queue != null) { - count1++; - } + Assert.assertNotNull(queue); + count1++; } int count2 = 0; for (CloudQueue queue : qClient.listQueues("")) { - if (queue != null) { - count2++; - } + Assert.assertNotNull(queue); + count2++; } int count3 = 0; for (CloudQueue queue : qClient.listQueues(null)) { - if (queue != null) { - count3++; - } + Assert.assertNotNull(queue); + count3++; } Assert.assertEquals(count1, count2); diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/CloudQueueTests.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/CloudQueueTests.java index 543b0b382cd3..699bbd128b10 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/CloudQueueTests.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/CloudQueueTests.java @@ -487,9 +487,8 @@ public void testClearMessages() throws URISyntaxException, StorageException, Uns int count = 0; for (CloudQueueMessage m : queue.peekMessages(32)) { - if (m != null) { - count++; - } + Assert.assertNotNull(m); + count++; } Assert.assertTrue(count == 2); @@ -500,9 +499,8 @@ public void testClearMessages() throws URISyntaxException, StorageException, Uns count = 0; for (CloudQueueMessage m : queue.peekMessages(32)) { - if (m != null) { - count++; - } + Assert.assertNotNull(m); + count++; } Assert.assertTrue(count == 0); From 5d6f96d3988c9ff18c8577ad50cc4d460e43a6dc Mon Sep 17 00:00:00 2001 From: "Jason Cooke (MSFT)" Date: Tue, 29 Jan 2013 11:11:16 -0800 Subject: [PATCH 5/8] Remove "catch (InterruptedException e)" that could obscure unexpected test failres. --- .../queue/client/CloudQueueTests.java | 40 +++++-------------- .../table/client/TableQueryTests.java | 11 ++--- 2 files changed, 14 insertions(+), 37 deletions(-) diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/CloudQueueTests.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/CloudQueueTests.java index 699bbd128b10..9258e5931787 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/CloudQueueTests.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/CloudQueueTests.java @@ -676,7 +676,7 @@ public void testAddMessageLargeMessageInput() throws URISyntaxException, Storage @Test public void testAddMessageWithVisibilityTimeout() throws URISyntaxException, StorageException, - UnsupportedEncodingException { + UnsupportedEncodingException, InterruptedException { final String queueName = UUID.randomUUID().toString().toLowerCase(); final CloudQueue queue = qClient.getQueueReference(queueName); queue.create(); @@ -685,12 +685,7 @@ public void testAddMessageWithVisibilityTimeout() throws URISyntaxException, Sto Date d1 = m1.getExpirationTime(); queue.deleteMessage(m1); - try { - Thread.sleep(2000); - } - catch (InterruptedException e) { - e.printStackTrace(); - } + Thread.sleep(2000); queue.addMessage(new CloudQueueMessage("message"), 20, 0, null, null); CloudQueueMessage m2 = queue.retrieveMessage(); @@ -819,7 +814,8 @@ public void testDeleteMessageNullMessage() throws URISyntaxException, StorageExc } @Test - public void testRetrieveMessage() throws URISyntaxException, StorageException, UnsupportedEncodingException { + public void testRetrieveMessage() throws URISyntaxException, StorageException, UnsupportedEncodingException, + InterruptedException { String queueName = UUID.randomUUID().toString().toLowerCase(); CloudQueue newQueue = qClient.getQueueReference(queueName); newQueue.create(); @@ -834,12 +830,7 @@ public void testRetrieveMessage() throws URISyntaxException, StorageException, U newQueue.deleteMessage(message1); - try { - Thread.sleep(2000); - } - catch (InterruptedException e) { - e.printStackTrace(); - } + Thread.sleep(2000); newQueue.addMessage(new CloudQueueMessage("message"), 20, 0, null, null); CloudQueueMessage message2 = newQueue.retrieveMessage(); @@ -917,7 +908,8 @@ public void testRetrieveMessagesNonFound() throws URISyntaxException, StorageExc } @Test - public void testDequeueCountIncreases() throws URISyntaxException, StorageException, UnsupportedEncodingException { + public void testDequeueCountIncreases() throws URISyntaxException, StorageException, UnsupportedEncodingException, + InterruptedException { String queueName = UUID.randomUUID().toString().toLowerCase(); CloudQueue newQueue = qClient.getQueueReference(queueName); newQueue.create(); @@ -926,13 +918,7 @@ public void testDequeueCountIncreases() throws URISyntaxException, StorageExcept Assert.assertTrue(message1.getDequeueCount() == 1); for (int i = 2; i < 5; i++) { - try { - Thread.sleep(2000); - } - catch (InterruptedException e) { - e.printStackTrace(); - } - + Thread.sleep(2000); CloudQueueMessage message2 = newQueue.retrieveMessage(1, null, null); Assert.assertTrue(message2.getDequeueCount() == i); } @@ -1146,7 +1132,8 @@ public void testUpdateMessage() throws URISyntaxException, StorageException, Uns } @Test - public void testUpdateMessageFullPass() throws URISyntaxException, StorageException, UnsupportedEncodingException { + public void testUpdateMessageFullPass() throws URISyntaxException, StorageException, UnsupportedEncodingException, + InterruptedException { String queueName = UUID.randomUUID().toString().toLowerCase(); CloudQueue newQueue = qClient.getQueueReference(queueName); newQueue.create(); @@ -1161,12 +1148,7 @@ public void testUpdateMessageFullPass() throws URISyntaxException, StorageExcept Assert.assertTrue(popreceipt2 != popreceipt1); Assert.assertTrue(NextVisibleTim1.before(NextVisibleTim2)); - try { - Thread.sleep(2000); - } - catch (InterruptedException e) { - e.printStackTrace(); - } + Thread.sleep(2000); String newMesage = message.getMessageContentAsString() + "updated"; message.setMessageContent(newMesage); diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableQueryTests.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableQueryTests.java index 8023517879ac..d8818dddc09c 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableQueryTests.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableQueryTests.java @@ -334,7 +334,7 @@ public void tableInvalidQuery() throws StorageException, IOException, URISyntaxE } @Test - public void testQueryOnSupportedTypes() throws StorageException { + public void testQueryOnSupportedTypes() throws StorageException, InterruptedException { // Setup TableBatchOperation batch = new TableBatchOperation(); String pk = UUID.randomUUID().toString(); @@ -359,13 +359,8 @@ public void testQueryOnSupportedTypes() throws StorageException { ent.setGuid(UUID.randomUUID()); ent.setString(String.format("%04d", j)); - try { - // Add delay to make times unique - Thread.sleep(100); - } - catch (InterruptedException e) { - e.printStackTrace(); - } + // Add delay to make times unique + Thread.sleep(100); batch.insert(ent); if (j == 50) { middleRef = ent; From 5912b78691016ecf03a7031c9355781b3d462195 Mon Sep 17 00:00:00 2001 From: "Jason Cooke (MSFT)" Date: Tue, 29 Jan 2013 12:09:00 -0800 Subject: [PATCH 6/8] Remove hard-coded Fiddler code in tests --- .../windowsazure/services/blob/client/BlobTestBase.java | 7 ------- .../windowsazure/services/queue/client/QueueTestBase.java | 7 ------- .../windowsazure/services/table/client/TableTestBase.java | 6 ------ 3 files changed, 20 deletions(-) diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/blob/client/BlobTestBase.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/blob/client/BlobTestBase.java index 81ac9334d8dc..cba0245c4270 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/blob/client/BlobTestBase.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/blob/client/BlobTestBase.java @@ -40,13 +40,6 @@ public class BlobTestBase { @BeforeClass public static void setup() throws URISyntaxException, StorageException, InvalidKeyException { - - // UNCOMMENT TO USE FIDDLER - System.setProperty("http.proxyHost", "localhost"); - System.setProperty("http.proxyPort", "8888"); - System.setProperty("https.proxyHost", "localhost"); - System.setProperty("https.proxyPort", "8888"); - if (USE_DEV_FABRIC) { httpAcc = CloudStorageAccount.getDevelopmentStorageAccount(); } diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/QueueTestBase.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/QueueTestBase.java index ead279ce3dbd..e44acb2a2100 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/QueueTestBase.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/QueueTestBase.java @@ -41,13 +41,6 @@ public class QueueTestBase { @BeforeClass public static void setup() throws URISyntaxException, StorageException, InvalidKeyException { - - // UNCOMMENT TO USE FIDDLER - System.setProperty("http.proxyHost", "localhost"); - System.setProperty("http.proxyPort", "8888"); - System.setProperty("https.proxyHost", "localhost"); - System.setProperty("https.proxyPort", "8888"); - if (USE_DEV_FABRIC) { httpAcc = CloudStorageAccount.getDevelopmentStorageAccount(); } diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableTestBase.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableTestBase.java index b5c68c6df876..91d4398f760d 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableTestBase.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableTestBase.java @@ -567,12 +567,6 @@ public static class1 generateRandomEnitity(String pk) { @BeforeClass public static void setup() throws URISyntaxException, StorageException, InvalidKeyException { - - //UNCOMMENT TO USE FIDDLER - System.setProperty("http.proxyHost", "localhost"); - System.setProperty("http.proxyPort", "8888"); - System.setProperty("https.proxyHost", "localhost"); - System.setProperty("https.proxyPort", "8888"); if (USE_DEV_FABRIC) { httpAcc = CloudStorageAccount.getDevelopmentStorageAccount(); } From cac506df1bc50e60128fb91ea9f0feae1a4cecf6 Mon Sep 17 00:00:00 2001 From: "Jason Cooke (MSFT)" Date: Tue, 29 Jan 2013 12:17:22 -0800 Subject: [PATCH 7/8] Adding deltas to assertEquals for Date and Double, which are likely to experience slight rounding error and cause transient failures. --- .../services/table/client/TableTestBase.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableTestBase.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableTestBase.java index 91d4398f760d..80c7ce30738a 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableTestBase.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableTestBase.java @@ -176,12 +176,13 @@ public void assertEquality(ComplexEntity other) { Assert.assertEquals(this.getPartitionKey(), other.getPartitionKey()); Assert.assertEquals(this.getRowKey(), other.getRowKey()); - Assert.assertEquals(this.getDateTime(), other.getDateTime()); + assertDateApproxEquals(this.getDateTime(), other.getDateTime(), 100); + Assert.assertEquals(this.getGuid(), other.getGuid()); Assert.assertEquals(this.getString(), other.getString()); - Assert.assertEquals(this.getDouble(), other.getDouble()); - Assert.assertEquals(this.getDoublePrimitive(), other.getDoublePrimitive()); + Assert.assertEquals(this.getDouble(), other.getDouble(), 1.0e-10); + Assert.assertEquals(this.getDoublePrimitive(), other.getDoublePrimitive(), 1.0e-10); Assert.assertEquals(this.getInt32(), other.getInt32()); Assert.assertEquals(this.getIntegerPrimitive(), other.getIntegerPrimitive()); Assert.assertEquals(this.getBool(), other.getBool()); @@ -192,6 +193,18 @@ public void assertEquality(ComplexEntity other) { Assert.assertTrue(Arrays.equals(this.getBinaryPrimitive(), other.getBinaryPrimitive())); } + protected void assertDateApproxEquals(Date expected, Date actual, int deltaInMs) { + if (expected == null || actual == null) { + Assert.assertEquals(expected, actual); + } + else { + long diffInMilliseconds = Math.abs(expected.getTime() - actual.getTime()); + if (diffInMilliseconds > deltaInMs) { + Assert.assertEquals(expected, actual); + } + } + } + /** * @return the binary */ From 2134d76b839d402d3e0cb9573c489c4799cbb12d Mon Sep 17 00:00:00 2001 From: "Jason Cooke (MSFT)" Date: Mon, 11 Feb 2013 16:06:32 -0800 Subject: [PATCH 8/8] Fixing new warnings --- .../ConnectionStringSyntaxException.java | 22 ++++++++++--------- .../implementation/ServiceBusRestProxy.java | 5 ++--- .../implementation/WrapTokenManager.java | 19 ++++++++-------- .../utils/ParsedConnectionStringTest.java | 13 ++++++----- 4 files changed, 31 insertions(+), 28 deletions(-) diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/ConnectionStringSyntaxException.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/ConnectionStringSyntaxException.java index 5f6a24c8f0ce..4b611302e2ca 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/ConnectionStringSyntaxException.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/ConnectionStringSyntaxException.java @@ -1,22 +1,24 @@ /** * Copyright 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 - * - * 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. + * 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 com.microsoft.windowsazure.services.core.utils; public class ConnectionStringSyntaxException extends Exception { + private static final long serialVersionUID = 9074252127254835859L; + public ConnectionStringSyntaxException(String message) { super(message); } diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java index 77220bb360e9..fa344e8e1eaa 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java @@ -21,7 +21,6 @@ import java.util.Date; import javax.inject.Inject; -import javax.inject.Named; import javax.ws.rs.core.MediaType; import org.apache.commons.logging.Log; @@ -73,8 +72,8 @@ public class ServiceBusRestProxy implements ServiceBusContract { ServiceFilter[] filters; @Inject - public ServiceBusRestProxy(Client channel, WrapFilter authFilter, - ServiceBusConnectionSettings connectionSettings, BrokerPropertiesMapper mapper) { + public ServiceBusRestProxy(Client channel, WrapFilter authFilter, ServiceBusConnectionSettings connectionSettings, + BrokerPropertiesMapper mapper) { this.channel = channel; this.filters = new ServiceFilter[0]; diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapTokenManager.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapTokenManager.java index df43072ce8cc..5255b4ec25cd 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapTokenManager.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapTokenManager.java @@ -2,15 +2,15 @@ * Copyright 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.implementation; @@ -23,7 +23,6 @@ import java.util.concurrent.ConcurrentHashMap; import javax.inject.Inject; -import javax.inject.Named; import javax.management.timer.Timer; import com.microsoft.windowsazure.services.core.ServiceException; @@ -41,7 +40,7 @@ public class WrapTokenManager { @Inject public WrapTokenManager(WrapContract contract, DateFactory dateFactory, - ServiceBusConnectionSettings connectionSettings) { + ServiceBusConnectionSettings connectionSettings) { this.contract = contract; this.dateFactory = dateFactory; this.uri = connectionSettings.getWrapUri(); diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/core/utils/ParsedConnectionStringTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/core/utils/ParsedConnectionStringTest.java index 6da2023a2ef9..68c5972d1d7f 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/core/utils/ParsedConnectionStringTest.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/core/utils/ParsedConnectionStringTest.java @@ -1,11 +1,11 @@ /** * Copyright 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 - * + * * 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. @@ -15,12 +15,13 @@ package com.microsoft.windowsazure.services.core.utils; -import com.microsoft.windowsazure.services.core.utils.pipeline.ConnectionStringField; +import static org.junit.Assert.*; + import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; -import static org.junit.Assert.*; +import com.microsoft.windowsazure.services.core.utils.pipeline.ConnectionStringField; public class ParsedConnectionStringTest { @@ -35,6 +36,7 @@ public String getAField() { return aField; } + @SuppressWarnings("unused") protected void setAField(String aField) { this.aField = aField; } @@ -52,7 +54,6 @@ private static class ThreeFields extends ParsedConnectionString { private String fieldTwo; private int fieldThree; - public ThreeFields(String connectionString) throws ConnectionStringSyntaxException { super(connectionString); } @@ -61,6 +62,7 @@ public String getFieldOne() { return fieldOne; } + @SuppressWarnings("unused") protected void setFieldOne(String fieldOne) { this.fieldOne = fieldOne; } @@ -69,6 +71,7 @@ public String getFieldTwo() { return fieldTwo; } + @SuppressWarnings("unused") protected void setFieldTwo(String fieldTwo) { this.fieldTwo = fieldTwo; }