package org.osgi.test.cases.jmx.junit;

import java.io.*;

import org.osgi.framework.*;
import org.osgi.jmx.service.permissionadmin.*;
import org.osgi.service.permissionadmin.*;

public class PermissionAdminMBeanTestCase extends MBeanGeneralTestCase {
	private PermissionAdminMBean pMBean;
	private PermissionAdmin pAdmin;

	@Override
	protected void setUp() throws Exception {
		// TODO Auto-generated method stub
		super.setUp();
		Bundle testbundle = super.install("tb2.jar");
		testbundle.start();
		
		super.install("tb1.jar");
		super.waitForRegistering(createObjectName(PermissionAdminMBean.OBJECTNAME));
		pMBean = getMBeanFromServer(PermissionAdminMBean.OBJECTNAME,
				PermissionAdminMBean.class);
		pAdmin = (PermissionAdmin) getContext().getService(
				getContext().getServiceReference(
						PermissionAdmin.class.getName()));
	}

	public void testGetPermissions() throws IOException {
		assertNotNull(pMBean);

		String[] serviceLocation = pAdmin.getLocations();
		String[] mBeanLocations = pMBean.listLocations();
		assertEquals(
				"got different information from mbean and direct service-call.",
				serviceLocation, mBeanLocations);
	}

	@Override
	protected void tearDown() throws Exception {
		super.tearDown();
		super.waitForUnRegistering(createObjectName(PermissionAdminMBean.OBJECTNAME));
	}
}

@@ -50,16 +50,41 @@
 va.io.*;
+%0Aimport java.util.Arrays;
 %0A%0Aimport
@@ -1060,14 +1060,12 @@
 sert
-Equals
+True
 (%0A%09%09
@@ -1135,16 +1135,30 @@
 .%22,%0A%09%09%09%09
+Arrays.equals(
 serviceL
@@ -1181,16 +1181,17 @@
 cations)
+)
 ;%0A%09%7D%0A%0A%09@

use array equals rather than object identity comparison