diff options
Diffstat (limited to 'framework/src/onos/core/api/src/test/java/org/onosproject/app')
6 files changed, 0 insertions, 379 deletions
diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/app/ApplicationAdminServiceAdapter.java b/framework/src/onos/core/api/src/test/java/org/onosproject/app/ApplicationAdminServiceAdapter.java deleted file mode 100644 index edcc2094..00000000 --- a/framework/src/onos/core/api/src/test/java/org/onosproject/app/ApplicationAdminServiceAdapter.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * 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. - */ -package org.onosproject.app; - -import org.onosproject.core.Application; -import org.onosproject.core.ApplicationId; -import org.onosproject.security.Permission; - -import java.io.InputStream; -import java.util.Set; - -/** - * Adapter for testing against application admin service. - */ -public class ApplicationAdminServiceAdapter extends ApplicationServiceAdapter - implements ApplicationAdminService { - @Override - public Set<Application> getApplications() { - return null; - } - - @Override - public Application getApplication(ApplicationId appId) { - return null; - } - - @Override - public ApplicationState getState(ApplicationId appId) { - return null; - } - - @Override - public Set<Permission> getPermissions(ApplicationId appId) { - return null; - } - - @Override - public void addListener(ApplicationListener listener) { - } - - @Override - public void removeListener(ApplicationListener listener) { - } - - @Override - public Application install(InputStream appDescStream) { - return null; - } - - @Override - public void uninstall(ApplicationId appId) { - } - - @Override - public void activate(ApplicationId appId) { - } - - @Override - public void deactivate(ApplicationId appId) { - } - - @Override - public void setPermissions(ApplicationId appId, Set<Permission> permissions) { - } -} diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/app/ApplicationEventTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/app/ApplicationEventTest.java deleted file mode 100644 index 34c593c4..00000000 --- a/framework/src/onos/core/api/src/test/java/org/onosproject/app/ApplicationEventTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * 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. - */ -package org.onosproject.app; - -import org.junit.Test; -import org.onosproject.core.Application; -import org.onosproject.core.DefaultApplication; -import org.onosproject.event.AbstractEventTest; - -import java.util.Optional; - -import static org.onosproject.app.ApplicationEvent.Type.APP_ACTIVATED; -import static org.onosproject.app.DefaultApplicationDescriptionTest.*; -import static org.onosproject.core.DefaultApplicationTest.APP_ID; - -/** - * Test of the application event. - */ -public class ApplicationEventTest extends AbstractEventTest { - - private Application createApp() { - return new DefaultApplication(APP_ID, VER, DESC, ORIGIN, ROLE, - PERMS, Optional.of(FURL), FEATURES, APPS); - } - - @Test - public void withoutTime() { - Application app = createApp(); - ApplicationEvent event = new ApplicationEvent(APP_ACTIVATED, app, 123L); - validateEvent(event, APP_ACTIVATED, app, 123L); - } - - @Test - public void withTime() { - Application app = createApp(); - long before = System.currentTimeMillis(); - ApplicationEvent event = new ApplicationEvent(APP_ACTIVATED, app); - long after = System.currentTimeMillis(); - validateEvent(event, APP_ACTIVATED, app, before, after); - } - -}
\ No newline at end of file diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/app/ApplicationExceptionTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/app/ApplicationExceptionTest.java deleted file mode 100644 index a0c7ef1c..00000000 --- a/framework/src/onos/core/api/src/test/java/org/onosproject/app/ApplicationExceptionTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * 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. - */ -package org.onosproject.app; - -import org.onlab.junit.ExceptionTest; - -public class ApplicationExceptionTest extends ExceptionTest { - - @Override - protected Exception getDefault() { - return new ApplicationException(); - } - - @Override - protected Exception getWithMessage() { - return new ApplicationException(MESSAGE); - } - - @Override - protected Exception getWithMessageAndCause() { - return new ApplicationException(MESSAGE, CAUSE); - } -}
\ No newline at end of file diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/app/ApplicationServiceAdapter.java b/framework/src/onos/core/api/src/test/java/org/onosproject/app/ApplicationServiceAdapter.java deleted file mode 100644 index 96324a91..00000000 --- a/framework/src/onos/core/api/src/test/java/org/onosproject/app/ApplicationServiceAdapter.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * 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. - */ -package org.onosproject.app; - -import org.onosproject.core.Application; -import org.onosproject.core.ApplicationId; -import org.onosproject.security.Permission; - -import java.util.Set; - -/** - * Adapter for testing against application service. - */ -public class ApplicationServiceAdapter implements ApplicationService { - @Override - public Set<Application> getApplications() { - return null; - } - - @Override - public ApplicationId getId(String name) { - return null; - } - - @Override - public Application getApplication(ApplicationId appId) { - return null; - } - - @Override - public ApplicationState getState(ApplicationId appId) { - return null; - } - - @Override - public Set<Permission> getPermissions(ApplicationId appId) { - return null; - } - - @Override - public void registerDeactivateHook(ApplicationId appId, Runnable hook) { - } - - @Override - public void addListener(ApplicationListener listener) { - } - - @Override - public void removeListener(ApplicationListener listener) { - } -} diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/app/ApplicationStoreAdapter.java b/framework/src/onos/core/api/src/test/java/org/onosproject/app/ApplicationStoreAdapter.java deleted file mode 100644 index 1a9ad8d2..00000000 --- a/framework/src/onos/core/api/src/test/java/org/onosproject/app/ApplicationStoreAdapter.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * 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. - */ -package org.onosproject.app; - -import org.onosproject.core.Application; -import org.onosproject.core.ApplicationId; -import org.onosproject.security.Permission; -import org.onosproject.store.AbstractStore; - -import java.io.InputStream; -import java.util.Set; - -/** - * Adapter for application testing against application store. - */ -public class ApplicationStoreAdapter - extends AbstractStore<ApplicationEvent, ApplicationStoreDelegate> - implements ApplicationStore { - @Override - public Set<Application> getApplications() { - return null; - } - - @Override - public ApplicationId getId(String name) { - return null; - } - - @Override - public Application getApplication(ApplicationId appId) { - return null; - } - - @Override - public ApplicationState getState(ApplicationId appId) { - return null; - } - - @Override - public Application create(InputStream appDescStream) { - return null; - } - - @Override - public void remove(ApplicationId appId) { - } - - @Override - public void activate(ApplicationId appId) { - } - - @Override - public void deactivate(ApplicationId appId) { - } - - @Override - public Set<Permission> getPermissions(ApplicationId appId) { - return null; - } - - @Override - public void setPermissions(ApplicationId appId, Set<Permission> permissions) { - } - -} diff --git a/framework/src/onos/core/api/src/test/java/org/onosproject/app/DefaultApplicationDescriptionTest.java b/framework/src/onos/core/api/src/test/java/org/onosproject/app/DefaultApplicationDescriptionTest.java deleted file mode 100644 index 0e93c1fe..00000000 --- a/framework/src/onos/core/api/src/test/java/org/onosproject/app/DefaultApplicationDescriptionTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * 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. - */ -package org.onosproject.app; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableSet; -import org.junit.Test; -import org.onosproject.core.ApplicationRole; -import org.onosproject.core.Version; -import org.onosproject.security.AppPermission; -import org.onosproject.security.Permission; - -import java.net.URI; -import java.util.List; -import java.util.Set; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - - -/** - * Basic tests of the default app description. - */ -public class DefaultApplicationDescriptionTest { - - public static final String APP_NAME = "org.foo.app"; - public static final Version VER = Version.version(1, 2, "a", null); - public static final String DESC = "Awesome application from Circus, Inc."; - public static final String ORIGIN = "Circus"; - public static final ApplicationRole ROLE = ApplicationRole.ADMIN; - public static final Set<Permission> PERMS = ImmutableSet.of( - new Permission(AppPermission.class.getName(), "FLOWRULE_WRITE"), - new Permission(AppPermission.class.getName(), "FLOWRULE_READ")); - public static final URI FURL = URI.create("mvn:org.foo-features/1.2a/xml/features"); - public static final List<String> FEATURES = ImmutableList.of("foo", "bar"); - public static final List<String> APPS = ImmutableList.of("fifi"); - - @Test - public void basics() { - ApplicationDescription app = - new DefaultApplicationDescription(APP_NAME, VER, DESC, ORIGIN, - ROLE, PERMS, FURL, FEATURES, APPS); - assertEquals("incorrect id", APP_NAME, app.name()); - assertEquals("incorrect version", VER, app.version()); - assertEquals("incorrect description", DESC, app.description()); - assertEquals("incorrect origin", ORIGIN, app.origin()); - assertEquals("incorect role", ROLE, app.role()); - assertEquals("incorrect permissions", PERMS, app.permissions()); - assertEquals("incorrect features repo", FURL, app.featuresRepo().get()); - assertEquals("incorrect features", FEATURES, app.features()); - assertEquals("incorrect apps", APPS, app.requiredApps()); - assertTrue("incorrect toString", app.toString().contains(APP_NAME)); - } - -}
\ No newline at end of file |