hotspot2: fix class/function/variable names to comply with API guideline
Bug: 34862444 Test: frameworks/base/wifi/tests/runtests.sh Test: frameworsk/opt/net/wifi/tests/wifitests/runtests.sh Change-Id: Ide425c06be46bc41c8f601e732dca0543de096b1
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package android.net.wifi.hotspot2;
|
package android.net.wifi.hotspot2;
|
||||||
|
|
||||||
import android.net.wifi.hotspot2.omadm.PPSMOParser;
|
import android.net.wifi.hotspot2.omadm.PpsMoParser;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Base64;
|
import android.util.Base64;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -44,8 +44,8 @@ import java.util.Map;
|
|||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public final class ConfigBuilder {
|
public final class ConfigParser {
|
||||||
private static final String TAG = "ConfigBuilder";
|
private static final String TAG = "ConfigParser";
|
||||||
|
|
||||||
// Header names.
|
// Header names.
|
||||||
private static final String CONTENT_TYPE = "Content-Type";
|
private static final String CONTENT_TYPE = "Content-Type";
|
||||||
@@ -101,7 +101,6 @@ public final class ConfigBuilder {
|
|||||||
public String encodingType = null;
|
public String encodingType = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse the Hotspot 2.0 Release 1 configuration data into a {@link PasspointConfiguration}
|
* Parse the Hotspot 2.0 Release 1 configuration data into a {@link PasspointConfiguration}
|
||||||
* object. The configuration data is a base64 encoded MIME multipart data. Below is
|
* object. The configuration data is a base64 encoded MIME multipart data. Below is
|
||||||
@@ -133,7 +132,7 @@ public final class ConfigBuilder {
|
|||||||
* certificate chain (optional).
|
* certificate chain (optional).
|
||||||
* @return {@link PasspointConfiguration}
|
* @return {@link PasspointConfiguration}
|
||||||
*/
|
*/
|
||||||
public static PasspointConfiguration buildPasspointConfig(String mimeType, byte[] data) {
|
public static PasspointConfiguration parsePasspointConfig(String mimeType, byte[] data) {
|
||||||
// Verify MIME type.
|
// Verify MIME type.
|
||||||
if (!TextUtils.equals(mimeType, TYPE_WIFI_CONFIG)) {
|
if (!TextUtils.equals(mimeType, TYPE_WIFI_CONFIG)) {
|
||||||
Log.e(TAG, "Unexpected MIME type: " + mimeType);
|
Log.e(TAG, "Unexpected MIME type: " + mimeType);
|
||||||
@@ -169,7 +168,7 @@ public final class ConfigBuilder {
|
|||||||
throw new IOException("Missing Passpoint Profile");
|
throw new IOException("Missing Passpoint Profile");
|
||||||
}
|
}
|
||||||
|
|
||||||
PasspointConfiguration config = PPSMOParser.parseMOText(new String(profileData));
|
PasspointConfiguration config = PpsMoParser.parseMoText(new String(profileData));
|
||||||
if (config == null) {
|
if (config == null) {
|
||||||
throw new IOException("Failed to parse Passpoint profile");
|
throw new IOException("Failed to parse Passpoint profile");
|
||||||
}
|
}
|
||||||
@@ -470,4 +469,4 @@ public final class ConfigBuilder {
|
|||||||
}
|
}
|
||||||
return new Pair<PrivateKey, List<X509Certificate>>(clientKey, clientCertificateChain);
|
return new Pair<PrivateKey, List<X509Certificate>>(clientKey, clientCertificateChain);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
package android.net.wifi.hotspot2;
|
package android.net.wifi.hotspot2;
|
||||||
|
|
||||||
import android.net.wifi.hotspot2.pps.Credential;
|
import android.net.wifi.hotspot2.pps.Credential;
|
||||||
import android.net.wifi.hotspot2.pps.HomeSP;
|
import android.net.wifi.hotspot2.pps.HomeSp;
|
||||||
import android.net.wifi.hotspot2.pps.Policy;
|
import android.net.wifi.hotspot2.pps.Policy;
|
||||||
import android.net.wifi.hotspot2.pps.UpdateParameter;
|
import android.net.wifi.hotspot2.pps.UpdateParameter;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
@@ -60,11 +60,11 @@ public final class PasspointConfiguration implements Parcelable {
|
|||||||
private static final int NULL_VALUE = -1;
|
private static final int NULL_VALUE = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configurations under HomeSP subtree.
|
* Configurations under HomeSp subtree.
|
||||||
*/
|
*/
|
||||||
private HomeSP mHomeSp = null;
|
private HomeSp mHomeSp = null;
|
||||||
public void setHomeSp(HomeSP homeSp) { mHomeSp = homeSp; }
|
public void setHomeSp(HomeSp homeSp) { mHomeSp = homeSp; }
|
||||||
public HomeSP getHomeSp() { return mHomeSp; }
|
public HomeSp getHomeSp() { return mHomeSp; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configurations under Credential subtree.
|
* Configurations under Credential subtree.
|
||||||
@@ -248,7 +248,7 @@ public final class PasspointConfiguration implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (source.mHomeSp != null) {
|
if (source.mHomeSp != null) {
|
||||||
mHomeSp = new HomeSP(source.mHomeSp);
|
mHomeSp = new HomeSp(source.mHomeSp);
|
||||||
}
|
}
|
||||||
if (source.mCredential != null) {
|
if (source.mCredential != null) {
|
||||||
mCredential = new Credential(source.mCredential);
|
mCredential = new Credential(source.mCredential);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ package android.net.wifi.hotspot2.omadm;
|
|||||||
|
|
||||||
import android.net.wifi.hotspot2.PasspointConfiguration;
|
import android.net.wifi.hotspot2.PasspointConfiguration;
|
||||||
import android.net.wifi.hotspot2.pps.Credential;
|
import android.net.wifi.hotspot2.pps.Credential;
|
||||||
import android.net.wifi.hotspot2.pps.HomeSP;
|
import android.net.wifi.hotspot2.pps.HomeSp;
|
||||||
import android.net.wifi.hotspot2.pps.Policy;
|
import android.net.wifi.hotspot2.pps.Policy;
|
||||||
import android.net.wifi.hotspot2.pps.UpdateParameter;
|
import android.net.wifi.hotspot2.pps.UpdateParameter;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
@@ -112,8 +112,8 @@ import org.xml.sax.SAXException;
|
|||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public final class PPSMOParser {
|
public final class PpsMoParser {
|
||||||
private static final String TAG = "PPSMOParser";
|
private static final String TAG = "PpsMoParser";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* XML tags expected in the PPS MO (PerProviderSubscription Management Object) XML tree.
|
* XML tags expected in the PPS MO (PerProviderSubscription Management Object) XML tree.
|
||||||
@@ -332,7 +332,7 @@ public final class PPSMOParser {
|
|||||||
* @param xmlString XML string representation of a PPS MO tree
|
* @param xmlString XML string representation of a PPS MO tree
|
||||||
* @return {@link PasspointConfiguration} or null
|
* @return {@link PasspointConfiguration} or null
|
||||||
*/
|
*/
|
||||||
public static PasspointConfiguration parseMOText(String xmlString) {
|
public static PasspointConfiguration parseMoText(String xmlString) {
|
||||||
// Convert the XML string to a XML tree.
|
// Convert the XML string to a XML tree.
|
||||||
XMLParser xmlParser = new XMLParser();
|
XMLParser xmlParser = new XMLParser();
|
||||||
XMLNode root = null;
|
XMLNode root = null;
|
||||||
@@ -640,12 +640,12 @@ public final class PPSMOParser {
|
|||||||
* @return HomeSP
|
* @return HomeSP
|
||||||
* @throws ParsingException
|
* @throws ParsingException
|
||||||
*/
|
*/
|
||||||
private static HomeSP parseHomeSP(PPSNode node) throws ParsingException {
|
private static HomeSp parseHomeSP(PPSNode node) throws ParsingException {
|
||||||
if (node.isLeaf()) {
|
if (node.isLeaf()) {
|
||||||
throw new ParsingException("Leaf node not expected for HomeSP");
|
throw new ParsingException("Leaf node not expected for HomeSP");
|
||||||
}
|
}
|
||||||
|
|
||||||
HomeSP homeSp = new HomeSP();
|
HomeSp homeSp = new HomeSp();
|
||||||
for (PPSNode child : node.getChildren()) {
|
for (PPSNode child : node.getChildren()) {
|
||||||
switch (child.getName()) {
|
switch (child.getName()) {
|
||||||
case NODE_FQDN:
|
case NODE_FQDN:
|
||||||
@@ -655,7 +655,7 @@ public final class PPSMOParser {
|
|||||||
homeSp.setFriendlyName(getPpsNodeValue(child));
|
homeSp.setFriendlyName(getPpsNodeValue(child));
|
||||||
break;
|
break;
|
||||||
case NODE_ROAMING_CONSORTIUM_OI:
|
case NODE_ROAMING_CONSORTIUM_OI:
|
||||||
homeSp.setRoamingConsortiumOIs(
|
homeSp.setRoamingConsortiumOis(
|
||||||
parseRoamingConsortiumOI(getPpsNodeValue(child)));
|
parseRoamingConsortiumOI(getPpsNodeValue(child)));
|
||||||
break;
|
break;
|
||||||
case NODE_ICON_URL:
|
case NODE_ICON_URL:
|
||||||
@@ -666,8 +666,8 @@ public final class PPSMOParser {
|
|||||||
break;
|
break;
|
||||||
case NODE_HOME_OI_LIST:
|
case NODE_HOME_OI_LIST:
|
||||||
Pair<List<Long>, List<Long>> homeOIs = parseHomeOIList(child);
|
Pair<List<Long>, List<Long>> homeOIs = parseHomeOIList(child);
|
||||||
homeSp.setMatchAllOIs(convertFromLongList(homeOIs.first));
|
homeSp.setMatchAllOis(convertFromLongList(homeOIs.first));
|
||||||
homeSp.setMatchAnyOIs(convertFromLongList(homeOIs.second));
|
homeSp.setMatchAnyOis(convertFromLongList(homeOIs.second));
|
||||||
break;
|
break;
|
||||||
case NODE_OTHER_HOME_PARTNERS:
|
case NODE_OTHER_HOME_PARTNERS:
|
||||||
homeSp.setOtherHomePartners(parseOtherHomePartners(child));
|
homeSp.setOtherHomePartners(parseOtherHomePartners(child));
|
||||||
@@ -909,7 +909,7 @@ public final class PPSMOParser {
|
|||||||
credential.setRealm(getPpsNodeValue(child));
|
credential.setRealm(getPpsNodeValue(child));
|
||||||
break;
|
break;
|
||||||
case NODE_CHECK_AAA_SERVER_CERT_STATUS:
|
case NODE_CHECK_AAA_SERVER_CERT_STATUS:
|
||||||
credential.setCheckAAAServerCertStatus(
|
credential.setCheckAaaServerCertStatus(
|
||||||
Boolean.parseBoolean(getPpsNodeValue(child)));
|
Boolean.parseBoolean(getPpsNodeValue(child)));
|
||||||
break;
|
break;
|
||||||
case NODE_SIM:
|
case NODE_SIM:
|
||||||
|
|||||||
@@ -98,12 +98,12 @@ public final class Credential implements Parcelable {
|
|||||||
* and Accounting) server's certificate during EAP (Extensible Authentication
|
* and Accounting) server's certificate during EAP (Extensible Authentication
|
||||||
* Protocol) authentication.
|
* Protocol) authentication.
|
||||||
*/
|
*/
|
||||||
private boolean mCheckAAAServerCertStatus = false;
|
private boolean mCheckAaaServerCertStatus = false;
|
||||||
public void setCheckAAAServerCertStatus(boolean checkAAAServerCertStatus) {
|
public void setCheckAaaServerCertStatus(boolean checkAaaServerCertStatus) {
|
||||||
mCheckAAAServerCertStatus = checkAAAServerCertStatus;
|
mCheckAaaServerCertStatus = checkAaaServerCertStatus;
|
||||||
}
|
}
|
||||||
public boolean getCheckAAAServerStatus() {
|
public boolean getCheckAaaServerStatus() {
|
||||||
return mCheckAAAServerCertStatus;
|
return mCheckAaaServerCertStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -685,7 +685,7 @@ public final class Credential implements Parcelable {
|
|||||||
mCreationTimeInMs = source.mCreationTimeInMs;
|
mCreationTimeInMs = source.mCreationTimeInMs;
|
||||||
mExpirationTimeInMs = source.mExpirationTimeInMs;
|
mExpirationTimeInMs = source.mExpirationTimeInMs;
|
||||||
mRealm = source.mRealm;
|
mRealm = source.mRealm;
|
||||||
mCheckAAAServerCertStatus = source.mCheckAAAServerCertStatus;
|
mCheckAaaServerCertStatus = source.mCheckAaaServerCertStatus;
|
||||||
if (source.mUserCredential != null) {
|
if (source.mUserCredential != null) {
|
||||||
mUserCredential = new UserCredential(source.mUserCredential);
|
mUserCredential = new UserCredential(source.mUserCredential);
|
||||||
}
|
}
|
||||||
@@ -714,7 +714,7 @@ public final class Credential implements Parcelable {
|
|||||||
dest.writeLong(mCreationTimeInMs);
|
dest.writeLong(mCreationTimeInMs);
|
||||||
dest.writeLong(mExpirationTimeInMs);
|
dest.writeLong(mExpirationTimeInMs);
|
||||||
dest.writeString(mRealm);
|
dest.writeString(mRealm);
|
||||||
dest.writeInt(mCheckAAAServerCertStatus ? 1 : 0);
|
dest.writeInt(mCheckAaaServerCertStatus ? 1 : 0);
|
||||||
dest.writeParcelable(mUserCredential, flags);
|
dest.writeParcelable(mUserCredential, flags);
|
||||||
dest.writeParcelable(mCertCredential, flags);
|
dest.writeParcelable(mCertCredential, flags);
|
||||||
dest.writeParcelable(mSimCredential, flags);
|
dest.writeParcelable(mSimCredential, flags);
|
||||||
@@ -736,7 +736,7 @@ public final class Credential implements Parcelable {
|
|||||||
return TextUtils.equals(mRealm, that.mRealm)
|
return TextUtils.equals(mRealm, that.mRealm)
|
||||||
&& mCreationTimeInMs == that.mCreationTimeInMs
|
&& mCreationTimeInMs == that.mCreationTimeInMs
|
||||||
&& mExpirationTimeInMs == that.mExpirationTimeInMs
|
&& mExpirationTimeInMs == that.mExpirationTimeInMs
|
||||||
&& mCheckAAAServerCertStatus == that.mCheckAAAServerCertStatus
|
&& mCheckAaaServerCertStatus == that.mCheckAaaServerCertStatus
|
||||||
&& (mUserCredential == null ? that.mUserCredential == null
|
&& (mUserCredential == null ? that.mUserCredential == null
|
||||||
: mUserCredential.equals(that.mUserCredential))
|
: mUserCredential.equals(that.mUserCredential))
|
||||||
&& (mCertCredential == null ? that.mCertCredential == null
|
&& (mCertCredential == null ? that.mCertCredential == null
|
||||||
@@ -751,7 +751,7 @@ public final class Credential implements Parcelable {
|
|||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(mRealm, mCreationTimeInMs, mExpirationTimeInMs,
|
return Objects.hash(mRealm, mCreationTimeInMs, mExpirationTimeInMs,
|
||||||
mCheckAAAServerCertStatus, mUserCredential, mCertCredential, mSimCredential,
|
mCheckAaaServerCertStatus, mUserCredential, mCertCredential, mSimCredential,
|
||||||
mCaCertificate, mClientCertificateChain, mClientPrivateKey);
|
mCaCertificate, mClientCertificateChain, mClientPrivateKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -800,7 +800,7 @@ public final class Credential implements Parcelable {
|
|||||||
credential.setCreationTimeInMs(in.readLong());
|
credential.setCreationTimeInMs(in.readLong());
|
||||||
credential.setExpirationTimeInMs(in.readLong());
|
credential.setExpirationTimeInMs(in.readLong());
|
||||||
credential.setRealm(in.readString());
|
credential.setRealm(in.readString());
|
||||||
credential.setCheckAAAServerCertStatus(in.readInt() != 0);
|
credential.setCheckAaaServerCertStatus(in.readInt() != 0);
|
||||||
credential.setUserCredential(in.readParcelable(null));
|
credential.setUserCredential(in.readParcelable(null));
|
||||||
credential.setCertCredential(in.readParcelable(null));
|
credential.setCertCredential(in.readParcelable(null));
|
||||||
credential.setSimCredential(in.readParcelable(null));
|
credential.setSimCredential(in.readParcelable(null));
|
||||||
|
|||||||
@@ -16,4 +16,4 @@
|
|||||||
|
|
||||||
package android.net.wifi.hotspot2.pps;
|
package android.net.wifi.hotspot2.pps;
|
||||||
|
|
||||||
parcelable HomeSP;
|
parcelable HomeSp;
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ import java.util.Objects;
|
|||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public final class HomeSP implements Parcelable {
|
public final class HomeSp implements Parcelable {
|
||||||
private static final String TAG = "HomeSP";
|
private static final String TAG = "HomeSp";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maximum number of bytes allowed for a SSID.
|
* Maximum number of bytes allowed for a SSID.
|
||||||
@@ -108,12 +108,12 @@ public final class HomeSP implements Parcelable {
|
|||||||
* Refer to HomeSP/HomeOIList subtree in PerProviderSubscription (PPS) Management Object
|
* Refer to HomeSP/HomeOIList subtree in PerProviderSubscription (PPS) Management Object
|
||||||
* (MO) tree for more detail.
|
* (MO) tree for more detail.
|
||||||
*/
|
*/
|
||||||
private long[] mMatchAllOIs = null;
|
private long[] mMatchAllOis = null;
|
||||||
public void setMatchAllOIs(long[] matchAllOIs) {
|
public void setMatchAllOis(long[] matchAllOis) {
|
||||||
mMatchAllOIs = matchAllOIs;
|
mMatchAllOis = matchAllOis;
|
||||||
}
|
}
|
||||||
public long[] getMatchAllOIs() {
|
public long[] getMatchAllOis() {
|
||||||
return mMatchAllOIs;
|
return mMatchAllOis;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -129,12 +129,12 @@ public final class HomeSP implements Parcelable {
|
|||||||
* Refer to HomeSP/HomeOIList subtree in PerProviderSubscription (PPS) Management Object
|
* Refer to HomeSP/HomeOIList subtree in PerProviderSubscription (PPS) Management Object
|
||||||
* (MO) tree for more detail.
|
* (MO) tree for more detail.
|
||||||
*/
|
*/
|
||||||
private long[] mMatchAnyOIs = null;
|
private long[] mMatchAnyOis = null;
|
||||||
public void setMatchAnyOIs(long[] matchAnyOIs) {
|
public void setMatchAnyOis(long[] matchAnyOis) {
|
||||||
mMatchAnyOIs = matchAnyOIs;
|
mMatchAnyOis = matchAnyOis;
|
||||||
}
|
}
|
||||||
public long[] getMatchAnysOIs() {
|
public long[] getMatchAnysOis() {
|
||||||
return mMatchAnyOIs;
|
return mMatchAnyOis;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -155,25 +155,25 @@ public final class HomeSP implements Parcelable {
|
|||||||
* List of Organization Identifiers (OIs) identifying a roaming consortium of
|
* List of Organization Identifiers (OIs) identifying a roaming consortium of
|
||||||
* which this provider is a member.
|
* which this provider is a member.
|
||||||
*/
|
*/
|
||||||
private long[] mRoamingConsortiumOIs = null;
|
private long[] mRoamingConsortiumOis = null;
|
||||||
public void setRoamingConsortiumOIs(long[] roamingConsortiumOIs) {
|
public void setRoamingConsortiumOis(long[] roamingConsortiumOis) {
|
||||||
mRoamingConsortiumOIs = roamingConsortiumOIs;
|
mRoamingConsortiumOis = roamingConsortiumOis;
|
||||||
}
|
}
|
||||||
public long[] getRoamingConsortiumOIs() {
|
public long[] getRoamingConsortiumOis() {
|
||||||
return mRoamingConsortiumOIs;
|
return mRoamingConsortiumOis;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for creating HomeSP with default values.
|
* Constructor for creating HomeSp with default values.
|
||||||
*/
|
*/
|
||||||
public HomeSP() {}
|
public HomeSp() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy constructor.
|
* Copy constructor.
|
||||||
*
|
*
|
||||||
* @param source The source to copy from
|
* @param source The source to copy from
|
||||||
*/
|
*/
|
||||||
public HomeSP(HomeSP source) {
|
public HomeSp(HomeSp source) {
|
||||||
if (source == null) {
|
if (source == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -183,19 +183,19 @@ public final class HomeSP implements Parcelable {
|
|||||||
if (source.mHomeNetworkIds != null) {
|
if (source.mHomeNetworkIds != null) {
|
||||||
mHomeNetworkIds = Collections.unmodifiableMap(source.mHomeNetworkIds);
|
mHomeNetworkIds = Collections.unmodifiableMap(source.mHomeNetworkIds);
|
||||||
}
|
}
|
||||||
if (source.mMatchAllOIs != null) {
|
if (source.mMatchAllOis != null) {
|
||||||
mMatchAllOIs = Arrays.copyOf(source.mMatchAllOIs, source.mMatchAllOIs.length);
|
mMatchAllOis = Arrays.copyOf(source.mMatchAllOis, source.mMatchAllOis.length);
|
||||||
}
|
}
|
||||||
if (source.mMatchAnyOIs != null) {
|
if (source.mMatchAnyOis != null) {
|
||||||
mMatchAnyOIs = Arrays.copyOf(source.mMatchAnyOIs, source.mMatchAnyOIs.length);
|
mMatchAnyOis = Arrays.copyOf(source.mMatchAnyOis, source.mMatchAnyOis.length);
|
||||||
}
|
}
|
||||||
if (source.mOtherHomePartners != null) {
|
if (source.mOtherHomePartners != null) {
|
||||||
mOtherHomePartners = Arrays.copyOf(source.mOtherHomePartners,
|
mOtherHomePartners = Arrays.copyOf(source.mOtherHomePartners,
|
||||||
source.mOtherHomePartners.length);
|
source.mOtherHomePartners.length);
|
||||||
}
|
}
|
||||||
if (source.mRoamingConsortiumOIs != null) {
|
if (source.mRoamingConsortiumOis != null) {
|
||||||
mRoamingConsortiumOIs = Arrays.copyOf(source.mRoamingConsortiumOIs,
|
mRoamingConsortiumOis = Arrays.copyOf(source.mRoamingConsortiumOis,
|
||||||
source.mRoamingConsortiumOIs.length);
|
source.mRoamingConsortiumOis.length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,10 +210,10 @@ public final class HomeSP implements Parcelable {
|
|||||||
dest.writeString(mFriendlyName);
|
dest.writeString(mFriendlyName);
|
||||||
dest.writeString(mIconUrl);
|
dest.writeString(mIconUrl);
|
||||||
writeHomeNetworkIds(dest, mHomeNetworkIds);
|
writeHomeNetworkIds(dest, mHomeNetworkIds);
|
||||||
dest.writeLongArray(mMatchAllOIs);
|
dest.writeLongArray(mMatchAllOis);
|
||||||
dest.writeLongArray(mMatchAnyOIs);
|
dest.writeLongArray(mMatchAnyOis);
|
||||||
dest.writeStringArray(mOtherHomePartners);
|
dest.writeStringArray(mOtherHomePartners);
|
||||||
dest.writeLongArray(mRoamingConsortiumOIs);
|
dest.writeLongArray(mRoamingConsortiumOis);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -221,30 +221,30 @@ public final class HomeSP implements Parcelable {
|
|||||||
if (this == thatObject) {
|
if (this == thatObject) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!(thatObject instanceof HomeSP)) {
|
if (!(thatObject instanceof HomeSp)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
HomeSP that = (HomeSP) thatObject;
|
HomeSp that = (HomeSp) thatObject;
|
||||||
|
|
||||||
return TextUtils.equals(mFqdn, that.mFqdn)
|
return TextUtils.equals(mFqdn, that.mFqdn)
|
||||||
&& TextUtils.equals(mFriendlyName, that.mFriendlyName)
|
&& TextUtils.equals(mFriendlyName, that.mFriendlyName)
|
||||||
&& TextUtils.equals(mIconUrl, that.mIconUrl)
|
&& TextUtils.equals(mIconUrl, that.mIconUrl)
|
||||||
&& (mHomeNetworkIds == null ? that.mHomeNetworkIds == null
|
&& (mHomeNetworkIds == null ? that.mHomeNetworkIds == null
|
||||||
: mHomeNetworkIds.equals(that.mHomeNetworkIds))
|
: mHomeNetworkIds.equals(that.mHomeNetworkIds))
|
||||||
&& Arrays.equals(mMatchAllOIs, that.mMatchAllOIs)
|
&& Arrays.equals(mMatchAllOis, that.mMatchAllOis)
|
||||||
&& Arrays.equals(mMatchAnyOIs, that.mMatchAnyOIs)
|
&& Arrays.equals(mMatchAnyOis, that.mMatchAnyOis)
|
||||||
&& Arrays.equals(mOtherHomePartners, that.mOtherHomePartners)
|
&& Arrays.equals(mOtherHomePartners, that.mOtherHomePartners)
|
||||||
&& Arrays.equals(mRoamingConsortiumOIs, that.mRoamingConsortiumOIs);
|
&& Arrays.equals(mRoamingConsortiumOis, that.mRoamingConsortiumOis);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(mFqdn, mFriendlyName, mIconUrl, mHomeNetworkIds, mMatchAllOIs,
|
return Objects.hash(mFqdn, mFriendlyName, mIconUrl, mHomeNetworkIds, mMatchAllOis,
|
||||||
mMatchAnyOIs, mOtherHomePartners, mRoamingConsortiumOIs);
|
mMatchAnyOis, mOtherHomePartners, mRoamingConsortiumOis);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate HomeSP data.
|
* Validate HomeSp data.
|
||||||
*
|
*
|
||||||
* @return true on success or false on failure
|
* @return true on success or false on failure
|
||||||
*/
|
*/
|
||||||
@@ -270,25 +270,25 @@ public final class HomeSP implements Parcelable {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Creator<HomeSP> CREATOR =
|
public static final Creator<HomeSp> CREATOR =
|
||||||
new Creator<HomeSP>() {
|
new Creator<HomeSp>() {
|
||||||
@Override
|
@Override
|
||||||
public HomeSP createFromParcel(Parcel in) {
|
public HomeSp createFromParcel(Parcel in) {
|
||||||
HomeSP homeSp = new HomeSP();
|
HomeSp homeSp = new HomeSp();
|
||||||
homeSp.setFqdn(in.readString());
|
homeSp.setFqdn(in.readString());
|
||||||
homeSp.setFriendlyName(in.readString());
|
homeSp.setFriendlyName(in.readString());
|
||||||
homeSp.setIconUrl(in.readString());
|
homeSp.setIconUrl(in.readString());
|
||||||
homeSp.setHomeNetworkIds(readHomeNetworkIds(in));
|
homeSp.setHomeNetworkIds(readHomeNetworkIds(in));
|
||||||
homeSp.setMatchAllOIs(in.createLongArray());
|
homeSp.setMatchAllOis(in.createLongArray());
|
||||||
homeSp.setMatchAnyOIs(in.createLongArray());
|
homeSp.setMatchAnyOis(in.createLongArray());
|
||||||
homeSp.setOtherHomePartners(in.createStringArray());
|
homeSp.setOtherHomePartners(in.createStringArray());
|
||||||
homeSp.setRoamingConsortiumOIs(in.createLongArray());
|
homeSp.setRoamingConsortiumOis(in.createLongArray());
|
||||||
return homeSp;
|
return homeSp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HomeSP[] newArray(int size) {
|
public HomeSp[] newArray(int size) {
|
||||||
return new HomeSP[size];
|
return new HomeSp[size];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import static org.junit.Assert.assertTrue;
|
|||||||
|
|
||||||
import android.net.wifi.FakeKeys;
|
import android.net.wifi.FakeKeys;
|
||||||
import android.net.wifi.hotspot2.pps.Credential;
|
import android.net.wifi.hotspot2.pps.Credential;
|
||||||
import android.net.wifi.hotspot2.pps.HomeSP;
|
import android.net.wifi.hotspot2.pps.HomeSp;
|
||||||
import android.test.suitebuilder.annotation.SmallTest;
|
import android.test.suitebuilder.annotation.SmallTest;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
@@ -33,10 +33,10 @@ import java.util.Arrays;
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit tests for {@link android.net.wifi.hotspot2.ConfigBuilder}.
|
* Unit tests for {@link android.net.wifi.hotspot2.ConfigParser}.
|
||||||
*/
|
*/
|
||||||
@SmallTest
|
@SmallTest
|
||||||
public class ConfigBuilderTest {
|
public class ConfigParserTest {
|
||||||
/**
|
/**
|
||||||
* Hotspot 2.0 Release 1 installation file that contains a Passpoint profile and a
|
* Hotspot 2.0 Release 1 installation file that contains a Passpoint profile and a
|
||||||
* CA (Certificate Authority) X.509 certificate {@link FakeKeys#CA_CERT0}.
|
* CA (Certificate Authority) X.509 certificate {@link FakeKeys#CA_CERT0}.
|
||||||
@@ -83,10 +83,10 @@ public class ConfigBuilderTest {
|
|||||||
PasspointConfiguration config = new PasspointConfiguration();
|
PasspointConfiguration config = new PasspointConfiguration();
|
||||||
|
|
||||||
// HomeSP configuration.
|
// HomeSP configuration.
|
||||||
HomeSP homeSp = new HomeSP();
|
HomeSp homeSp = new HomeSp();
|
||||||
homeSp.setFriendlyName("Century House");
|
homeSp.setFriendlyName("Century House");
|
||||||
homeSp.setFqdn("mi6.co.uk");
|
homeSp.setFqdn("mi6.co.uk");
|
||||||
homeSp.setRoamingConsortiumOIs(new long[] {0x112233L, 0x445566L});
|
homeSp.setRoamingConsortiumOis(new long[] {0x112233L, 0x445566L});
|
||||||
config.setHomeSp(homeSp);
|
config.setHomeSp(homeSp);
|
||||||
|
|
||||||
// Credential configuration.
|
// Credential configuration.
|
||||||
@@ -123,7 +123,7 @@ public class ConfigBuilderTest {
|
|||||||
String configStr = loadResourceFile(PASSPOINT_INSTALLATION_FILE_WITH_CA_CERT);
|
String configStr = loadResourceFile(PASSPOINT_INSTALLATION_FILE_WITH_CA_CERT);
|
||||||
PasspointConfiguration expectedConfig = generateConfigurationFromProfile();
|
PasspointConfiguration expectedConfig = generateConfigurationFromProfile();
|
||||||
PasspointConfiguration actualConfig =
|
PasspointConfiguration actualConfig =
|
||||||
ConfigBuilder.buildPasspointConfig(
|
ConfigParser.parsePasspointConfig(
|
||||||
"application/x-wifi-config", configStr.getBytes());
|
"application/x-wifi-config", configStr.getBytes());
|
||||||
assertTrue(actualConfig.equals(expectedConfig));
|
assertTrue(actualConfig.equals(expectedConfig));
|
||||||
}
|
}
|
||||||
@@ -136,7 +136,7 @@ public class ConfigBuilderTest {
|
|||||||
@Test
|
@Test
|
||||||
public void parseConfigFileWithInvalidMimeType() throws Exception {
|
public void parseConfigFileWithInvalidMimeType() throws Exception {
|
||||||
String configStr = loadResourceFile(PASSPOINT_INSTALLATION_FILE_WITH_CA_CERT);
|
String configStr = loadResourceFile(PASSPOINT_INSTALLATION_FILE_WITH_CA_CERT);
|
||||||
assertNull(ConfigBuilder.buildPasspointConfig(
|
assertNull(ConfigParser.parsePasspointConfig(
|
||||||
"application/wifi-config", configStr.getBytes()));
|
"application/wifi-config", configStr.getBytes()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,7 +148,7 @@ public class ConfigBuilderTest {
|
|||||||
@Test
|
@Test
|
||||||
public void parseConfigFileWithUnencodedData() throws Exception {
|
public void parseConfigFileWithUnencodedData() throws Exception {
|
||||||
String configStr = loadResourceFile(PASSPOINT_INSTALLATION_FILE_WITH_UNENCODED_DATA);
|
String configStr = loadResourceFile(PASSPOINT_INSTALLATION_FILE_WITH_UNENCODED_DATA);
|
||||||
assertNull(ConfigBuilder.buildPasspointConfig(
|
assertNull(ConfigParser.parsePasspointConfig(
|
||||||
"application/x-wifi-config", configStr.getBytes()));
|
"application/x-wifi-config", configStr.getBytes()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,7 +160,7 @@ public class ConfigBuilderTest {
|
|||||||
@Test
|
@Test
|
||||||
public void parseConfigFileWithInvalidPart() throws Exception {
|
public void parseConfigFileWithInvalidPart() throws Exception {
|
||||||
String configStr = loadResourceFile(PASSPOINT_INSTALLATION_FILE_WITH_INVALID_PART);
|
String configStr = loadResourceFile(PASSPOINT_INSTALLATION_FILE_WITH_INVALID_PART);
|
||||||
assertNull(ConfigBuilder.buildPasspointConfig(
|
assertNull(ConfigParser.parsePasspointConfig(
|
||||||
"application/x-wifi-config", configStr.getBytes()));
|
"application/x-wifi-config", configStr.getBytes()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,7 +172,7 @@ public class ConfigBuilderTest {
|
|||||||
@Test
|
@Test
|
||||||
public void parseConfigFileWithMissingBoundary() throws Exception {
|
public void parseConfigFileWithMissingBoundary() throws Exception {
|
||||||
String configStr = loadResourceFile(PASSPOINT_INSTALLATION_FILE_WITH_MISSING_BOUNDARY);
|
String configStr = loadResourceFile(PASSPOINT_INSTALLATION_FILE_WITH_MISSING_BOUNDARY);
|
||||||
assertNull(ConfigBuilder.buildPasspointConfig(
|
assertNull(ConfigParser.parsePasspointConfig(
|
||||||
"application/x-wifi-config", configStr.getBytes()));
|
"application/x-wifi-config", configStr.getBytes()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,7 +185,7 @@ public class ConfigBuilderTest {
|
|||||||
@Test
|
@Test
|
||||||
public void parseConfigFileWithInvalidContentType() throws Exception {
|
public void parseConfigFileWithInvalidContentType() throws Exception {
|
||||||
String configStr = loadResourceFile(PASSPOINT_INSTALLATION_FILE_WITH_INVALID_CONTENT_TYPE);
|
String configStr = loadResourceFile(PASSPOINT_INSTALLATION_FILE_WITH_INVALID_CONTENT_TYPE);
|
||||||
assertNull(ConfigBuilder.buildPasspointConfig(
|
assertNull(ConfigParser.parsePasspointConfig(
|
||||||
"application/x-wifi-config", configStr.getBytes()));
|
"application/x-wifi-config", configStr.getBytes()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,7 +197,7 @@ public class ConfigBuilderTest {
|
|||||||
@Test
|
@Test
|
||||||
public void parseConfigFileWithoutPasspointProfile() throws Exception {
|
public void parseConfigFileWithoutPasspointProfile() throws Exception {
|
||||||
String configStr = loadResourceFile(PASSPOINT_INSTALLATION_FILE_WITHOUT_PROFILE);
|
String configStr = loadResourceFile(PASSPOINT_INSTALLATION_FILE_WITHOUT_PROFILE);
|
||||||
assertNull(ConfigBuilder.buildPasspointConfig(
|
assertNull(ConfigParser.parsePasspointConfig(
|
||||||
"application/x-wifi-config", configStr.getBytes()));
|
"application/x-wifi-config", configStr.getBytes()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -21,7 +21,7 @@ import static org.junit.Assert.assertTrue;
|
|||||||
|
|
||||||
import android.net.wifi.EAPConstants;
|
import android.net.wifi.EAPConstants;
|
||||||
import android.net.wifi.hotspot2.pps.Credential;
|
import android.net.wifi.hotspot2.pps.Credential;
|
||||||
import android.net.wifi.hotspot2.pps.HomeSP;
|
import android.net.wifi.hotspot2.pps.HomeSp;
|
||||||
import android.net.wifi.hotspot2.pps.Policy;
|
import android.net.wifi.hotspot2.pps.Policy;
|
||||||
import android.net.wifi.hotspot2.pps.UpdateParameter;
|
import android.net.wifi.hotspot2.pps.UpdateParameter;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
@@ -50,11 +50,11 @@ public class PasspointConfigurationTest {
|
|||||||
*
|
*
|
||||||
* @return {@link android.net.wifi.hotspot2.pps.HomeSP}
|
* @return {@link android.net.wifi.hotspot2.pps.HomeSP}
|
||||||
*/
|
*/
|
||||||
private static HomeSP createHomeSp() {
|
private static HomeSp createHomeSp() {
|
||||||
HomeSP homeSp = new HomeSP();
|
HomeSp homeSp = new HomeSp();
|
||||||
homeSp.setFqdn("fqdn");
|
homeSp.setFqdn("fqdn");
|
||||||
homeSp.setFriendlyName("friendly name");
|
homeSp.setFriendlyName("friendly name");
|
||||||
homeSp.setRoamingConsortiumOIs(new long[] {0x55, 0x66});
|
homeSp.setRoamingConsortiumOis(new long[] {0x55, 0x66});
|
||||||
return homeSp;
|
return homeSp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,10 +19,10 @@ package android.net.wifi.hotspot2.omadm;
|
|||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import android.net.wifi.hotspot2.omadm.PPSMOParser;
|
import android.net.wifi.hotspot2.omadm.PpsMoParser;
|
||||||
import android.net.wifi.hotspot2.PasspointConfiguration;
|
import android.net.wifi.hotspot2.PasspointConfiguration;
|
||||||
import android.net.wifi.hotspot2.pps.Credential;
|
import android.net.wifi.hotspot2.pps.Credential;
|
||||||
import android.net.wifi.hotspot2.pps.HomeSP;
|
import android.net.wifi.hotspot2.pps.HomeSp;
|
||||||
import android.net.wifi.hotspot2.pps.Policy;
|
import android.net.wifi.hotspot2.pps.Policy;
|
||||||
import android.net.wifi.hotspot2.pps.UpdateParameter;
|
import android.net.wifi.hotspot2.pps.UpdateParameter;
|
||||||
import android.test.suitebuilder.annotation.SmallTest;
|
import android.test.suitebuilder.annotation.SmallTest;
|
||||||
@@ -43,10 +43,10 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit tests for {@link android.net.wifi.hotspot2.omadm.PPSMOParser}.
|
* Unit tests for {@link android.net.wifi.hotspot2.omadm.PpsMoParser}.
|
||||||
*/
|
*/
|
||||||
@SmallTest
|
@SmallTest
|
||||||
public class PPSMOParserTest {
|
public class PpsMoParserTest {
|
||||||
private static final String VALID_PPS_MO_XML_FILE = "assets/pps/PerProviderSubscription.xml";
|
private static final String VALID_PPS_MO_XML_FILE = "assets/pps/PerProviderSubscription.xml";
|
||||||
private static final String PPS_MO_XML_FILE_DUPLICATE_HOMESP =
|
private static final String PPS_MO_XML_FILE_DUPLICATE_HOMESP =
|
||||||
"assets/pps/PerProviderSubscription_DuplicateHomeSP.xml";
|
"assets/pps/PerProviderSubscription_DuplicateHomeSP.xml";
|
||||||
@@ -122,17 +122,17 @@ public class PPSMOParserTest {
|
|||||||
config.setUsageLimitUsageTimePeriodInMinutes(99910);
|
config.setUsageLimitUsageTimePeriodInMinutes(99910);
|
||||||
|
|
||||||
// HomeSP configuration.
|
// HomeSP configuration.
|
||||||
HomeSP homeSp = new HomeSP();
|
HomeSp homeSp = new HomeSp();
|
||||||
homeSp.setFriendlyName("Century House");
|
homeSp.setFriendlyName("Century House");
|
||||||
homeSp.setFqdn("mi6.co.uk");
|
homeSp.setFqdn("mi6.co.uk");
|
||||||
homeSp.setRoamingConsortiumOIs(new long[] {0x112233L, 0x445566L});
|
homeSp.setRoamingConsortiumOis(new long[] {0x112233L, 0x445566L});
|
||||||
homeSp.setIconUrl("icon.test.com");
|
homeSp.setIconUrl("icon.test.com");
|
||||||
Map<String, Long> homeNetworkIds = new HashMap<>();
|
Map<String, Long> homeNetworkIds = new HashMap<>();
|
||||||
homeNetworkIds.put("TestSSID", 0x12345678L);
|
homeNetworkIds.put("TestSSID", 0x12345678L);
|
||||||
homeNetworkIds.put("NullHESSID", null);
|
homeNetworkIds.put("NullHESSID", null);
|
||||||
homeSp.setHomeNetworkIds(homeNetworkIds);
|
homeSp.setHomeNetworkIds(homeNetworkIds);
|
||||||
homeSp.setMatchAllOIs(new long[] {0x11223344});
|
homeSp.setMatchAllOis(new long[] {0x11223344});
|
||||||
homeSp.setMatchAnyOIs(new long[] {0x55667788});
|
homeSp.setMatchAnyOis(new long[] {0x55667788});
|
||||||
homeSp.setOtherHomePartners(new String[] {"other.fqdn.com"});
|
homeSp.setOtherHomePartners(new String[] {"other.fqdn.com"});
|
||||||
config.setHomeSp(homeSp);
|
config.setHomeSp(homeSp);
|
||||||
|
|
||||||
@@ -141,7 +141,7 @@ public class PPSMOParserTest {
|
|||||||
credential.setCreationTimeInMs(format.parse("2016-01-01T10:00:00Z").getTime());
|
credential.setCreationTimeInMs(format.parse("2016-01-01T10:00:00Z").getTime());
|
||||||
credential.setExpirationTimeInMs(format.parse("2016-02-01T10:00:00Z").getTime());
|
credential.setExpirationTimeInMs(format.parse("2016-02-01T10:00:00Z").getTime());
|
||||||
credential.setRealm("shaken.stirred.com");
|
credential.setRealm("shaken.stirred.com");
|
||||||
credential.setCheckAAAServerCertStatus(true);
|
credential.setCheckAaaServerCertStatus(true);
|
||||||
Credential.UserCredential userCredential = new Credential.UserCredential();
|
Credential.UserCredential userCredential = new Credential.UserCredential();
|
||||||
userCredential.setUsername("james");
|
userCredential.setUsername("james");
|
||||||
userCredential.setPassword("Ym9uZDAwNw==");
|
userCredential.setPassword("Ym9uZDAwNw==");
|
||||||
@@ -209,53 +209,53 @@ public class PPSMOParserTest {
|
|||||||
public void parseValidPPSMOTree() throws Exception {
|
public void parseValidPPSMOTree() throws Exception {
|
||||||
String ppsMoTree = loadResourceFile(VALID_PPS_MO_XML_FILE);
|
String ppsMoTree = loadResourceFile(VALID_PPS_MO_XML_FILE);
|
||||||
PasspointConfiguration expectedConfig = generateConfigurationFromPPSMOTree();
|
PasspointConfiguration expectedConfig = generateConfigurationFromPPSMOTree();
|
||||||
PasspointConfiguration actualConfig = PPSMOParser.parseMOText(ppsMoTree);
|
PasspointConfiguration actualConfig = PpsMoParser.parseMoText(ppsMoTree);
|
||||||
assertTrue(actualConfig.equals(expectedConfig));
|
assertTrue(actualConfig.equals(expectedConfig));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void parseNullPPSMOTree() throws Exception {
|
public void parseNullPPSMOTree() throws Exception {
|
||||||
assertEquals(null, PPSMOParser.parseMOText(null));
|
assertEquals(null, PpsMoParser.parseMoText(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void parseEmptyPPSMOTree() throws Exception {
|
public void parseEmptyPPSMOTree() throws Exception {
|
||||||
assertEquals(null, PPSMOParser.parseMOText(new String()));
|
assertEquals(null, PpsMoParser.parseMoText(new String()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void parsePPSMOTreeWithDuplicateHomeSP() throws Exception {
|
public void parsePPSMOTreeWithDuplicateHomeSP() throws Exception {
|
||||||
assertEquals(null, PPSMOParser.parseMOText(
|
assertEquals(null, PpsMoParser.parseMoText(
|
||||||
loadResourceFile(PPS_MO_XML_FILE_DUPLICATE_HOMESP)));
|
loadResourceFile(PPS_MO_XML_FILE_DUPLICATE_HOMESP)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void parsePPSMOTreeWithDuplicateValue() throws Exception {
|
public void parsePPSMOTreeWithDuplicateValue() throws Exception {
|
||||||
assertEquals(null, PPSMOParser.parseMOText(
|
assertEquals(null, PpsMoParser.parseMoText(
|
||||||
loadResourceFile(PPS_MO_XML_FILE_DUPLICATE_VALUE)));
|
loadResourceFile(PPS_MO_XML_FILE_DUPLICATE_VALUE)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void parsePPSMOTreeWithMissingValue() throws Exception {
|
public void parsePPSMOTreeWithMissingValue() throws Exception {
|
||||||
assertEquals(null, PPSMOParser.parseMOText(
|
assertEquals(null, PpsMoParser.parseMoText(
|
||||||
loadResourceFile(PPS_MO_XML_FILE_MISSING_VALUE)));
|
loadResourceFile(PPS_MO_XML_FILE_MISSING_VALUE)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void parsePPSMOTreeWithMissingName() throws Exception {
|
public void parsePPSMOTreeWithMissingName() throws Exception {
|
||||||
assertEquals(null, PPSMOParser.parseMOText(
|
assertEquals(null, PpsMoParser.parseMoText(
|
||||||
loadResourceFile(PPS_MO_XML_FILE_MISSING_NAME)));
|
loadResourceFile(PPS_MO_XML_FILE_MISSING_NAME)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void parsePPSMOTreeWithInvalidNode() throws Exception {
|
public void parsePPSMOTreeWithInvalidNode() throws Exception {
|
||||||
assertEquals(null, PPSMOParser.parseMOText(
|
assertEquals(null, PpsMoParser.parseMoText(
|
||||||
loadResourceFile(PPS_MO_XML_FILE_INVALID_NODE)));
|
loadResourceFile(PPS_MO_XML_FILE_INVALID_NODE)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void parsePPSMOTreeWithInvalidName() throws Exception {
|
public void parsePPSMOTreeWithInvalidName() throws Exception {
|
||||||
assertEquals(null, PPSMOParser.parseMOText(
|
assertEquals(null, PpsMoParser.parseMoText(
|
||||||
loadResourceFile(PPS_MO_XML_FILE_INVALID_NAME)));
|
loadResourceFile(PPS_MO_XML_FILE_INVALID_NAME)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class CredentialTest {
|
|||||||
cred.setCreationTimeInMs(123455L);
|
cred.setCreationTimeInMs(123455L);
|
||||||
cred.setExpirationTimeInMs(2310093L);
|
cred.setExpirationTimeInMs(2310093L);
|
||||||
cred.setRealm("realm");
|
cred.setRealm("realm");
|
||||||
cred.setCheckAAAServerCertStatus(true);
|
cred.setCheckAaaServerCertStatus(true);
|
||||||
cred.setUserCredential(userCred);
|
cred.setUserCredential(userCred);
|
||||||
cred.setCertCredential(certCred);
|
cred.setCertCredential(certCred);
|
||||||
cred.setSimCredential(simCred);
|
cred.setSimCredential(simCred);
|
||||||
|
|||||||
@@ -30,10 +30,10 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit tests for {@link android.net.wifi.hotspot2.pps.HomeSP}.
|
* Unit tests for {@link android.net.wifi.hotspot2.pps.HomeSp}.
|
||||||
*/
|
*/
|
||||||
@SmallTest
|
@SmallTest
|
||||||
public class HomeSPTest {
|
public class HomeSpTest {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function for creating a map of home network IDs for testing.
|
* Helper function for creating a map of home network IDs for testing.
|
||||||
@@ -48,68 +48,68 @@ public class HomeSPTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function for creating a HomeSP for testing.
|
* Helper function for creating a HomeSp for testing.
|
||||||
*
|
*
|
||||||
* @param homeNetworkIds The map of home network IDs associated with HomeSP
|
* @param homeNetworkIds The map of home network IDs associated with HomeSp
|
||||||
* @return {@link HomeSP}
|
* @return {@link HomeSp}
|
||||||
*/
|
*/
|
||||||
private static HomeSP createHomeSp(Map<String, Long> homeNetworkIds) {
|
private static HomeSp createHomeSp(Map<String, Long> homeNetworkIds) {
|
||||||
HomeSP homeSp = new HomeSP();
|
HomeSp homeSp = new HomeSp();
|
||||||
homeSp.setFqdn("fqdn");
|
homeSp.setFqdn("fqdn");
|
||||||
homeSp.setFriendlyName("friendly name");
|
homeSp.setFriendlyName("friendly name");
|
||||||
homeSp.setIconUrl("icon.url");
|
homeSp.setIconUrl("icon.url");
|
||||||
homeSp.setHomeNetworkIds(homeNetworkIds);
|
homeSp.setHomeNetworkIds(homeNetworkIds);
|
||||||
homeSp.setMatchAllOIs(new long[] {0x11L, 0x22L});
|
homeSp.setMatchAllOis(new long[] {0x11L, 0x22L});
|
||||||
homeSp.setMatchAnyOIs(new long[] {0x33L, 0x44L});
|
homeSp.setMatchAnyOis(new long[] {0x33L, 0x44L});
|
||||||
homeSp.setOtherHomePartners(new String[] {"partner1", "partner2"});
|
homeSp.setOtherHomePartners(new String[] {"partner1", "partner2"});
|
||||||
homeSp.setRoamingConsortiumOIs(new long[] {0x55, 0x66});
|
homeSp.setRoamingConsortiumOis(new long[] {0x55, 0x66});
|
||||||
return homeSp;
|
return homeSp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function for creating a HomeSP with home network IDs for testing.
|
* Helper function for creating a HomeSp with home network IDs for testing.
|
||||||
*
|
*
|
||||||
* @return {@link HomeSP}
|
* @return {@link HomeSp}
|
||||||
*/
|
*/
|
||||||
private static HomeSP createHomeSpWithHomeNetworkIds() {
|
private static HomeSp createHomeSpWithHomeNetworkIds() {
|
||||||
return createHomeSp(createHomeNetworkIds());
|
return createHomeSp(createHomeNetworkIds());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function for creating a HomeSP without home network IDs for testing.
|
* Helper function for creating a HomeSp without home network IDs for testing.
|
||||||
*
|
*
|
||||||
* @return {@link HomeSP}
|
* @return {@link HomeSp}
|
||||||
*/
|
*/
|
||||||
private static HomeSP createHomeSpWithoutHomeNetworkIds() {
|
private static HomeSp createHomeSpWithoutHomeNetworkIds() {
|
||||||
return createHomeSp(null);
|
return createHomeSp(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function for verifying HomeSP after parcel write then read.
|
* Helper function for verifying HomeSp after parcel write then read.
|
||||||
* @param writeHomeSp
|
* @param writeHomeSp
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private static void verifyParcel(HomeSP writeHomeSp) throws Exception {
|
private static void verifyParcel(HomeSp writeHomeSp) throws Exception {
|
||||||
Parcel parcel = Parcel.obtain();
|
Parcel parcel = Parcel.obtain();
|
||||||
writeHomeSp.writeToParcel(parcel, 0);
|
writeHomeSp.writeToParcel(parcel, 0);
|
||||||
|
|
||||||
parcel.setDataPosition(0); // Rewind data position back to the beginning for read.
|
parcel.setDataPosition(0); // Rewind data position back to the beginning for read.
|
||||||
HomeSP readHomeSp = HomeSP.CREATOR.createFromParcel(parcel);
|
HomeSp readHomeSp = HomeSp.CREATOR.createFromParcel(parcel);
|
||||||
assertTrue(readHomeSp.equals(writeHomeSp));
|
assertTrue(readHomeSp.equals(writeHomeSp));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify parcel read/write for an empty HomeSP.
|
* Verify parcel read/write for an empty HomeSp.
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void verifyParcelWithEmptyHomeSP() throws Exception {
|
public void verifyParcelWithEmptyHomeSp() throws Exception {
|
||||||
verifyParcel(new HomeSP());
|
verifyParcel(new HomeSp());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify parcel read/write for a HomeSP containing Home Network IDs.
|
* Verify parcel read/write for a HomeSp containing Home Network IDs.
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@@ -119,7 +119,7 @@ public class HomeSPTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify parcel read/write for a HomeSP without Home Network IDs.
|
* Verify parcel read/write for a HomeSp without Home Network IDs.
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@@ -129,62 +129,62 @@ public class HomeSPTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify that a HomeSP is valid when both FQDN and Friendly Name
|
* Verify that a HomeSp is valid when both FQDN and Friendly Name
|
||||||
* are provided.
|
* are provided.
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void validateValidHomeSP() throws Exception {
|
public void validateValidHomeSp() throws Exception {
|
||||||
HomeSP homeSp = createHomeSpWithHomeNetworkIds();
|
HomeSp homeSp = createHomeSpWithHomeNetworkIds();
|
||||||
assertTrue(homeSp.validate());
|
assertTrue(homeSp.validate());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify that a HomeSP is not valid when FQDN is not provided
|
* Verify that a HomeSp is not valid when FQDN is not provided
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void validateHomeSpWithoutFqdn() throws Exception {
|
public void validateHomeSpWithoutFqdn() throws Exception {
|
||||||
HomeSP homeSp = createHomeSpWithHomeNetworkIds();
|
HomeSp homeSp = createHomeSpWithHomeNetworkIds();
|
||||||
homeSp.setFqdn(null);
|
homeSp.setFqdn(null);
|
||||||
assertFalse(homeSp.validate());
|
assertFalse(homeSp.validate());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify that a HomeSP is not valid when Friendly Name is not provided
|
* Verify that a HomeSp is not valid when Friendly Name is not provided
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void validateHomeSpWithoutFriendlyName() throws Exception {
|
public void validateHomeSpWithoutFriendlyName() throws Exception {
|
||||||
HomeSP homeSp = createHomeSpWithHomeNetworkIds();
|
HomeSp homeSp = createHomeSpWithHomeNetworkIds();
|
||||||
homeSp.setFriendlyName(null);
|
homeSp.setFriendlyName(null);
|
||||||
assertFalse(homeSp.validate());
|
assertFalse(homeSp.validate());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify that a HomeSP is valid when the optional Home Network IDs are
|
* Verify that a HomeSp is valid when the optional Home Network IDs are
|
||||||
* not provided.
|
* not provided.
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void validateHomeSpWithoutHomeNetworkIds() throws Exception {
|
public void validateHomeSpWithoutHomeNetworkIds() throws Exception {
|
||||||
HomeSP homeSp = createHomeSpWithoutHomeNetworkIds();
|
HomeSp homeSp = createHomeSpWithoutHomeNetworkIds();
|
||||||
assertTrue(homeSp.validate());
|
assertTrue(homeSp.validate());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify that a HomeSP is invalid when the optional Home Network IDs
|
* Verify that a HomeSp is invalid when the optional Home Network IDs
|
||||||
* contained an invalid SSID (exceeding maximum number of bytes).
|
* contained an invalid SSID (exceeding maximum number of bytes).
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void validateHomeSpWithInvalidHomeNetworkIds() throws Exception {
|
public void validateHomeSpWithInvalidHomeNetworkIds() throws Exception {
|
||||||
HomeSP homeSp = createHomeSpWithoutHomeNetworkIds();
|
HomeSp homeSp = createHomeSpWithoutHomeNetworkIds();
|
||||||
// HomeNetworkID with SSID exceeding the maximum length.
|
// HomeNetworkID with SSID exceeding the maximum length.
|
||||||
Map<String, Long> homeNetworkIds = new HashMap<>();
|
Map<String, Long> homeNetworkIds = new HashMap<>();
|
||||||
byte[] rawSsidBytes = new byte[33];
|
byte[] rawSsidBytes = new byte[33];
|
||||||
@@ -202,8 +202,8 @@ public class HomeSPTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void validateCopyConstructorFromNullSource() throws Exception {
|
public void validateCopyConstructorFromNullSource() throws Exception {
|
||||||
HomeSP copySp = new HomeSP(null);
|
HomeSp copySp = new HomeSp(null);
|
||||||
HomeSP defaultSp = new HomeSP();
|
HomeSp defaultSp = new HomeSp();
|
||||||
assertTrue(copySp.equals(defaultSp));
|
assertTrue(copySp.equals(defaultSp));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,8 +214,8 @@ public class HomeSPTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void validateCopyConstructorFromValidSource() throws Exception {
|
public void validateCopyConstructorFromValidSource() throws Exception {
|
||||||
HomeSP sourceSp = createHomeSpWithHomeNetworkIds();
|
HomeSp sourceSp = createHomeSpWithHomeNetworkIds();
|
||||||
HomeSP copySp = new HomeSP(sourceSp);
|
HomeSp copySp = new HomeSp(sourceSp);
|
||||||
assertTrue(copySp.equals(sourceSp));
|
assertTrue(copySp.equals(sourceSp));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user