Search in sources :

Example 11 with Application

use of org.onosproject.core.Application in project onos by opennetworkinglab.

the class SimpleApplicationStoreTest method permissions.

@Test
public void permissions() {
    Application app = createTestApp();
    ImmutableSet<Permission> permissions = ImmutableSet.of(new Permission(AppPermission.class.getName(), "FLOWRULE_WRITE"));
    store.setPermissions(app.id(), permissions);
    assertEquals("incorrect app perms", 1, store.getPermissions(app.id()).size());
    assertEquals("incorrect app state", INSTALLED, store.getState(app.id()));
    assertEquals("incorrect event type", APP_PERMISSIONS_CHANGED, delegate.event.type());
    assertEquals("incorrect event app", app, delegate.event.subject());
}
Also used : Permission(org.onosproject.security.Permission) AppPermission(org.onosproject.security.AppPermission) Application(org.onosproject.core.Application) Test(org.junit.Test)

Example 12 with Application

use of org.onosproject.core.Application in project onos by opennetworkinglab.

the class SimpleApplicationStoreTest method remove.

@Test
public void remove() {
    Application app = createTestApp();
    store.remove(app.id());
    assertEquals("incorrect app count", 0, store.getApplications().size());
    assertEquals("incorrect event type", APP_UNINSTALLED, delegate.event.type());
    assertEquals("incorrect event app", app, delegate.event.subject());
}
Also used : Application(org.onosproject.core.Application) Test(org.junit.Test)

Example 13 with Application

use of org.onosproject.core.Application in project onos by opennetworkinglab.

the class SimpleApplicationStoreTest method activate.

@Test
public void activate() {
    Application app = createTestApp();
    store.activate(app.id());
    assertEquals("incorrect app count", 1, store.getApplications().size());
    assertEquals("incorrect app state", ACTIVE, store.getState(app.id()));
    assertEquals("incorrect event type", APP_ACTIVATED, delegate.event.type());
    assertEquals("incorrect event app", app, delegate.event.subject());
}
Also used : Application(org.onosproject.core.Application) Test(org.junit.Test)

Example 14 with Application

use of org.onosproject.core.Application in project onos by opennetworkinglab.

the class SimpleApplicationStoreTest method create.

@Test
public void create() {
    Application app = createTestApp();
    assertEquals("incorrect name", "org.foo.app", app.id().name());
    assertEquals("incorrect app count", 1, store.getApplications().size());
    assertEquals("incorrect app", app, store.getApplication(app.id()));
    assertEquals("incorrect app state", INSTALLED, store.getState(app.id()));
    assertEquals("incorrect event type", APP_INSTALLED, delegate.event.type());
    assertEquals("incorrect event app", app, delegate.event.subject());
}
Also used : Application(org.onosproject.core.Application) Test(org.junit.Test)

Example 15 with Application

use of org.onosproject.core.Application in project onos by opennetworkinglab.

the class SimpleApplicationStore method activate.

@Override
public void activate(ApplicationId appId) {
    Application app = apps.get(appId);
    if (app != null) {
        setActive(appId.name());
        states.put(appId, ACTIVE);
        delegate.notify(new ApplicationEvent(APP_ACTIVATED, app));
    }
}
Also used : ApplicationEvent(org.onosproject.app.ApplicationEvent) Application(org.onosproject.core.Application) DefaultApplication(org.onosproject.core.DefaultApplication)

Aggregations

Application (org.onosproject.core.Application)32 DefaultApplication (org.onosproject.core.DefaultApplication)12 Test (org.junit.Test)8 List (java.util.List)6 ApplicationAdminService (org.onosproject.app.ApplicationAdminService)6 ApplicationEvent (org.onosproject.app.ApplicationEvent)6 ApplicationId (org.onosproject.core.ApplicationId)6 IOException (java.io.IOException)4 Lists (com.google.common.collect.Lists)3 InputStream (java.io.InputStream)3 Collectors (java.util.stream.Collectors)3 Service (org.apache.karaf.shell.api.action.lifecycle.Service)3 ApplicationService (org.onosproject.app.ApplicationService)3 ApplicationState (org.onosproject.app.ApplicationState)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)2 Charsets (com.google.common.base.Charsets)2 MoreObjects (com.google.common.base.MoreObjects)2 Preconditions (com.google.common.base.Preconditions)2 Throwables (com.google.common.base.Throwables)2