import static com.google.common.base.Preconditions.checkState;
import static java.lang.String.format;
import static org.opendaylight.controller.config.yangjmxgenerator.ConfigConstants.createConfigQName;
-
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Function;
import com.google.common.base.Optional;
String moduleLocalNameFromXPath = matcher.group(1);
IdentitySchemaNode moduleIdentity = moduleIdentities.get(moduleLocalNameFromXPath);
unaugmentedModuleIdentities.remove(moduleLocalNameFromXPath);
- checkState(moduleIdentity != null, "Cannot find identity " + moduleLocalNameFromXPath
- + " matching augmentation " + augmentation);
+ checkState(moduleIdentity != null, "Cannot find identity %s matching augmentation %s", moduleLocalNameFromXPath, augmentation);
Map<String, QName> providedServices = findProvidedServices(moduleIdentity, currentModule, qNamesToSIEs,
schemaContext);
- if (moduleIdentity == null) {
- throw new IllegalStateException("Cannot find identity specified by augmentation xpath constraint: "
- + moduleLocalNameFromXPath + " of " + augmentation);
- }
String javaNamePrefix = TypeProviderWrapper.findJavaNamePrefix(moduleIdentity);
Map<String, AttributeIfc> yangToAttributes = null;
}
}
- private void checkUniqueAttributesWithGeneratedClass(final Map<String, QName> uniqueGeneratedClassNames,
+ private static void checkUniqueAttributesWithGeneratedClass(final Map<String, QName> uniqueGeneratedClassNames,
final QName parentQName, final Map<String, AttributeIfc> yangToAttributes) {
for (Map.Entry<String, AttributeIfc> attr : yangToAttributes.entrySet()) {
if (attr.getValue() instanceof TOAttribute) {
}
}
- private void checkUniqueTOAttr(final Map<String, QName> uniqueGeneratedClassNames, final QName parentQName, final TOAttribute attr) {
+ private static void checkUniqueTOAttr(final Map<String, QName> uniqueGeneratedClassNames, final QName parentQName, final TOAttribute attr) {
final String upperCaseCamelCase = attr.getUpperCaseCammelCase();
if (uniqueGeneratedClassNames.containsKey(upperCaseCamelCase)) {
QName firstDefinedQName = uniqueGeneratedClassNames.get(upperCaseCamelCase);
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkState;
-
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Function;
import com.google.common.base.Optional;
final List<RuntimeBeanEntry> children, final Set<Rpc> rpcs) {
checkArgument(isRoot == false || keyYangName.isPresent() == false,
- "Root RuntimeBeanEntry must not have key " + "set");
+ "Root RuntimeBeanEntry must not have key set");
this.packageName = packageName;
this.isRoot = isRoot;
this.yangName = yangName;
for (AttributeIfc a : attributes) {
checkState(map.containsKey(a.getAttributeYangName()) == false,
- "Attribute already defined: " + a.getAttributeYangName()
- + " in " + nodeForReporting);
+ "Attribute already defined: %s in %s", a.getAttributeYangName(), nodeForReporting);
map.put(a.getAttributeYangName(), a);
}
if (keyYangName.isPresent()) {
AttributeIfc keyJavaName = map.get(keyYangName.get());
- checkArgument(keyJavaName != null, "Key " + keyYangName.get()
- + " not found in attribute " + "list " + attributes
- + " in " + nodeForReporting);
+ checkArgument(keyJavaName != null, "Key %s not found in attribute list %s in %s", keyYangName.get(),
+ attributes, nodeForReporting);
this.keyJavaName = Optional
.of(keyJavaName.getUpperCaseCammelCase());
} else {
package org.opendaylight.controller.config.yangjmxgenerator;
import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.isA;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
-
import com.google.common.collect.Sets;
import java.net.URI;
import java.net.URISyntaxException;
is("threadFactory"));
assertThat(threadFactoryAttribute.getUpperCaseCammelCase(),
is("ThreadFactory"));
- assertThat(threadFactoryAttribute.getOpenType(), is(SimpleType.class));
+ assertThat(threadFactoryAttribute.getOpenType(), isA(SimpleType.class));
assertNull(threadFactoryAttribute.getNullableDefault());
assertNull(threadFactoryAttribute.getNullableDescription());
assertThat(threadFactoryAttribute.getType().getName(), is("ObjectName"));
assertThat(toAttr.getAttributeYangName(), is("peer"));
assertThat(toAttr.getLowerCaseCammelCase(), is("peer"));
assertThat(toAttr.getUpperCaseCammelCase(), is("Peer"));
- assertThat(toAttr.getOpenType(), is(CompositeType.class));
+ assertThat(toAttr.getOpenType(), isA(CompositeType.class));
Set<String> propsExpected = new HashSet<String>(2);
propsExpected.add("port");
propsExpected.add("core-size");
is("innerStreamList"));
assertThat(innerStream.getUpperCaseCammelCase(),
is("InnerStreamList"));
- assertThat(innerStream.getOpenType(), is(ArrayType.class));
+ assertThat(innerStream.getOpenType(), isA(ArrayType.class));
}