Refactor construction of application objects
- Use a builder and make the constructors private for DefaultApplication
- Make DefaultApplication immutable
- Use a builder and make the constructors private for DefaultApplicationDescription
- Make DefaultApplicationDescription immutable
Change-Id: I9499981bd2c0f48aede40682260d51eeae2cab98
diff --git a/core/net/src/test/java/org/onosproject/app/impl/ApplicationManagerTest.java b/core/net/src/test/java/org/onosproject/app/impl/ApplicationManagerTest.java
index 5fd7701..5528f26 100644
--- a/core/net/src/test/java/org/onosproject/app/impl/ApplicationManagerTest.java
+++ b/core/net/src/test/java/org/onosproject/app/impl/ApplicationManagerTest.java
@@ -15,7 +15,6 @@
*/
package org.onosproject.app.impl;
-import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import org.junit.After;
import org.junit.Before;
@@ -138,9 +137,22 @@
@Override
public Application create(InputStream appDescStream) {
- app = new DefaultApplication(APP_ID, VER, TITLE, DESC, ORIGIN, CATEGORY,
- URL, README, ICON, ROLE, PERMS,
- Optional.of(FURL), FEATURES, ImmutableList.of());
+ app = DefaultApplication.builder()
+ .withAppId(APP_ID)
+ .withVersion(VER)
+ .withTitle(TITLE)
+ .withDescription(DESC)
+ .withOrigin(ORIGIN)
+ .withCategory(CATEGORY)
+ .withUrl(URL)
+ .withReadme(README)
+ .withIcon(ICON)
+ .withRole(ROLE)
+ .withPermissions(PERMS)
+ .withFeaturesRepo(Optional.of(FURL))
+ .withFeatures(FEATURES)
+ .withRequiredApps(APPS)
+ .build();
state = INSTALLED;
delegate.notify(new ApplicationEvent(APP_INSTALLED, app));
return app;
@@ -211,4 +223,4 @@
}
}
-}
\ No newline at end of file
+}