Fix compilation error 07/39907/4
authorRobert Varga <rovarga@cisco.com>
Mon, 6 Jun 2016 22:13:55 +0000 (00:13 +0200)
committerRobert Varga <rovarga@cisco.com>
Mon, 6 Jun 2016 23:00:19 +0000 (01:00 +0200)
SourceIdentifier has lost the public constructor. Use the static
factory method instead.

Change-Id: I634f8b8c9e9f7b92a4edbbad4580fb1bdf179eaf
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/config/config-manager-facade-xml/src/main/java/org/opendaylight/controller/config/facade/xml/osgi/YangStoreSnapshot.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/schema/provider/impl/YangTextSchemaSourceSerializationProxy.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/schema/provider/impl/RemoteSchemaProviderTest.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/schema/provider/impl/RemoteYangTextSourceProviderImplTest.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/schema/provider/impl/YangTextSourceSerializationProxyTest.java

index 6778670..2335457 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.controller.config.facade.xml.osgi;
 
 import com.google.common.base.Charsets;
+import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.BiMap;
 import com.google.common.collect.Maps;
@@ -150,10 +151,8 @@ final class YangStoreSnapshot implements YangStoreContext, EnumResolver {
     @Override
     public String getModuleSource(final org.opendaylight.yangtools.yang.model.api.ModuleIdentifier moduleIdentifier) {
         final CheckedFuture<? extends YangTextSchemaSource, SchemaSourceException> source = sourceProvider.getSource(
-            moduleIdentifier.getRevision() == null ?
-                new SourceIdentifier(moduleIdentifier.getName()) :
-                new SourceIdentifier(moduleIdentifier.getName(),
-                    QName.formattedRevision(moduleIdentifier.getRevision())));
+            SourceIdentifier.create(moduleIdentifier.getName(), Optional.fromNullable(
+                QName.formattedRevision(moduleIdentifier.getRevision()))));
 
         try {
             final YangTextSchemaSource yangTextSchemaSource = source.checkedGet();
index 8c1f8d0..ed3538b 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.controller.cluster.schema.provider.impl;
 
 import com.google.common.annotations.Beta;
+import com.google.common.base.Optional;
 import com.google.common.io.ByteSource;
 import java.io.IOException;
 import java.io.Serializable;
@@ -33,6 +34,7 @@ public class YangTextSchemaSourceSerializationProxy implements Serializable {
     }
 
     public YangTextSchemaSource getRepresentation() {
-        return YangTextSchemaSource.delegateForByteSource(new SourceIdentifier(name, revision), ByteSource.wrap(schemaSource));
+        return YangTextSchemaSource.delegateForByteSource(SourceIdentifier.create(name, Optional.of(revision)),
+            ByteSource.wrap(schemaSource));
     }
 }
index 3429600..1ba2ef0 100644 (file)
@@ -14,6 +14,7 @@ import static org.junit.Assert.assertTrue;
 
 import akka.dispatch.ExecutionContexts;
 import akka.dispatch.Futures;
+import com.google.common.base.Optional;
 import com.google.common.io.ByteSource;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.MoreExecutors;
@@ -28,7 +29,7 @@ import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
 
 public class RemoteSchemaProviderTest {
 
-    private static final SourceIdentifier ID = new SourceIdentifier("Test", "2015-10-30");
+    private static final SourceIdentifier ID = SourceIdentifier.create("Test", Optional.of("2015-10-30"));
 
     private RemoteSchemaProvider remoteSchemaProvider;
     private RemoteYangTextSourceProvider mockedRemoteSchemaRepository;
@@ -64,4 +65,4 @@ public class RemoteSchemaProviderTest {
         assertTrue(sourceFuture.isDone());
         sourceFuture.checkedGet();
     }
-}
\ No newline at end of file
+}
index 360d210..5d97dba 100644 (file)
@@ -12,6 +12,7 @@ import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
+import com.google.common.base.Optional;
 import com.google.common.io.ByteSource;
 import com.google.common.util.concurrent.Futures;
 import java.util.Collections;
@@ -29,7 +30,7 @@ import scala.concurrent.duration.Duration;
 
 public class RemoteYangTextSourceProviderImplTest {
 
-    private static final SourceIdentifier ID = new SourceIdentifier("Test", "2015-10-30");
+    private static final SourceIdentifier ID = SourceIdentifier.create("Test", Optional.of("2015-10-30"));
 
     private RemoteYangTextSourceProviderImpl remoteRepository;
     private SchemaRepository mockedLocalRepository;
index 18bc34c..4ddd7dd 100644 (file)
@@ -11,13 +11,14 @@ package org.opendaylight.controller.cluster.schema.provider.impl;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 
-import com.google.common.base.Charsets;
+import com.google.common.base.Optional;
 import com.google.common.io.ByteSource;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
+import java.nio.charset.StandardCharsets;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
@@ -31,7 +32,8 @@ public class YangTextSourceSerializationProxyTest {
     public void setUp() {
         String source = "Test source.";
         schemaSource = YangTextSchemaSource.delegateForByteSource(
-                new SourceIdentifier("test", "2015-10-30"), ByteSource.wrap(source.getBytes(Charsets.UTF_8)));
+                SourceIdentifier.create("test", Optional.of("2015-10-30")),
+                ByteSource.wrap(source.getBytes(StandardCharsets.UTF_8)));
     }