From 6d77f94919cde944f512658638d5fb6227db8db8 Mon Sep 17 00:00:00 2001 From: Khaled Abdelmohsen Date: Tue, 12 Nov 2019 16:47:01 +0000 Subject: Use minified tag names for rule XML Shortened tag names are less readable, but provide better size savings for rules when represented in files to be serialized or parsed. Bug: 143697198 Test: atest FrameworksServicesTests:RuleXmlParserTest Test: atest FrameworksServicesTests:RuleXmlSerializerTest Change-Id: I29f71b34d9be5fe3d0e2cbf05fe46c4ff3dbe5c7 --- .../server/integrity/parser/RuleXmlParser.java | 26 +- .../integrity/serializer/RuleXmlSerializer.java | 19 +- .../server/integrity/parser/RuleXmlParserTest.java | 428 ++++++++++----------- .../serializer/RuleXmlSerializerTest.java | 188 ++++----- 4 files changed, 330 insertions(+), 331 deletions(-) diff --git a/services/core/java/com/android/server/integrity/parser/RuleXmlParser.java b/services/core/java/com/android/server/integrity/parser/RuleXmlParser.java index ef5bb6ee1e79..23d0b40f08f6 100644 --- a/services/core/java/com/android/server/integrity/parser/RuleXmlParser.java +++ b/services/core/java/com/android/server/integrity/parser/RuleXmlParser.java @@ -41,15 +41,15 @@ public final class RuleXmlParser implements RuleParser { public static final String TAG = "RuleXmlParser"; // TODO: Use XML attributes - private static final String RULE_LIST_TAG = "RuleList"; - private static final String RULE_TAG = "Rule"; - private static final String OPEN_FORMULA_TAG = "OpenFormula"; - private static final String ATOMIC_FORMULA_TAG = "AtomicFormula"; - private static final String EFFECT_TAG = "Effect"; - private static final String KEY_TAG = "Key"; - private static final String OPERATOR_TAG = "Operator"; - private static final String VALUE_TAG = "Value"; - private static final String CONNECTOR_TAG = "Connector"; + private static final String RULE_LIST_TAG = "RL"; + private static final String RULE_TAG = "R"; + private static final String OPEN_FORMULA_TAG = "OF"; + private static final String ATOMIC_FORMULA_TAG = "AF"; + private static final String EFFECT_TAG = "E"; + private static final String KEY_TAG = "K"; + private static final String OPERATOR_TAG = "O"; + private static final String VALUE_TAG = "V"; + private static final String CONNECTOR_TAG = "C"; @Override public List parse(String ruleText) throws RuleParseException { @@ -80,16 +80,16 @@ public final class RuleXmlParser implements RuleParser { // Skipping the first event type, which is always {@link XmlPullParser.START_DOCUMENT} parser.next(); - // Processing the first tag; which should always be a tag. + // Processing the first tag; which should always be a RuleList tag. String nodeName = parser.getName(); - // Validating that the XML is starting with a tag. + // Validating that the XML is starting with a RuleList tag. // Note: This is the only breaking validation to run against XML files in the platform. // All rules inside are assumed to be validated at the server. If a rule is found to be // corrupt in the XML, it will be skipped to the next rule. if (!nodeName.equals(RULE_LIST_TAG)) { throw new RuntimeException( - String.format("Rules must start with tag. Found: %s at %s", nodeName, - parser.getPositionDescription())); + String.format("Rules must start with RuleList tag. Found: %s at %s", + nodeName, parser.getPositionDescription())); } int eventType; diff --git a/services/core/java/com/android/server/integrity/serializer/RuleXmlSerializer.java b/services/core/java/com/android/server/integrity/serializer/RuleXmlSerializer.java index 98042bba9206..b0805fc488cb 100644 --- a/services/core/java/com/android/server/integrity/serializer/RuleXmlSerializer.java +++ b/services/core/java/com/android/server/integrity/serializer/RuleXmlSerializer.java @@ -39,16 +39,15 @@ public class RuleXmlSerializer implements RuleSerializer { public static final String TAG = "RuleXmlSerializer"; private static final String NAMESPACE = ""; - // TODO: Use smaller tag names. - private static final String RULE_LIST_TAG = "RuleList"; - private static final String RULE_TAG = "Rule"; - private static final String OPEN_FORMULA_TAG = "OpenFormula"; - private static final String ATOMIC_FORMULA_TAG = "AtomicFormula"; - private static final String EFFECT_TAG = "Effect"; - private static final String KEY_TAG = "Key"; - private static final String OPERATOR_TAG = "Operator"; - private static final String VALUE_TAG = "Value"; - private static final String CONNECTOR_TAG = "Connector"; + private static final String RULE_LIST_TAG = "RL"; + private static final String RULE_TAG = "R"; + private static final String OPEN_FORMULA_TAG = "OF"; + private static final String ATOMIC_FORMULA_TAG = "AF"; + private static final String EFFECT_TAG = "E"; + private static final String KEY_TAG = "K"; + private static final String OPERATOR_TAG = "O"; + private static final String VALUE_TAG = "V"; + private static final String CONNECTOR_TAG = "C"; @Override public void serialize(List rules, OutputStream outputStream) diff --git a/services/tests/servicestests/src/com/android/server/integrity/parser/RuleXmlParserTest.java b/services/tests/servicestests/src/com/android/server/integrity/parser/RuleXmlParserTest.java index 3b1c3c2b5e8b..975689db5264 100644 --- a/services/tests/servicestests/src/com/android/server/integrity/parser/RuleXmlParserTest.java +++ b/services/tests/servicestests/src/com/android/server/integrity/parser/RuleXmlParserTest.java @@ -39,19 +39,19 @@ public class RuleXmlParserTest { @Test public void testXmlStream_validOpenFormula() throws Exception { - String ruleXmlOpenFormula = "" - + "" - + "" - + "" + OpenFormula.NOT + "" - + "" - + "" + AtomicFormula.PACKAGE_NAME + "" - + "" + AtomicFormula.EQ + "" - + "com.app.test" - + "" - + "" - + "" + Rule.DENY + "" - + "" - + ""; + String ruleXmlOpenFormula = "" + + "" + + "" + + "" + OpenFormula.NOT + "" + + "" + + "" + AtomicFormula.PACKAGE_NAME + "" + + "" + AtomicFormula.EQ + "" + + "com.app.test" + + "" + + "" + + "" + Rule.DENY + "" + + "" + + ""; RuleParser xmlParser = new RuleXmlParser(); InputStream inputStream = new ByteArrayInputStream(ruleXmlOpenFormula.getBytes()); Rule expectedRule = new Rule(new OpenFormula(OpenFormula.NOT, Collections.singletonList( @@ -65,19 +65,19 @@ public class RuleXmlParserTest { @Test public void testXmlString_validOpenFormula_notConnector() throws Exception { - String ruleXmlOpenFormula = "" - + "" - + "" - + "" + OpenFormula.NOT + "" - + "" - + "" + AtomicFormula.PACKAGE_NAME + "" - + "" + AtomicFormula.EQ + "" - + "com.app.test" - + "" - + "" - + "" + Rule.DENY + "" - + "" - + ""; + String ruleXmlOpenFormula = "" + + "" + + "" + + "" + OpenFormula.NOT + "" + + "" + + "" + AtomicFormula.PACKAGE_NAME + "" + + "" + AtomicFormula.EQ + "" + + "com.app.test" + + "" + + "" + + "" + Rule.DENY + "" + + "" + + ""; RuleParser xmlParser = new RuleXmlParser(); Rule expectedRule = new Rule(new OpenFormula(OpenFormula.NOT, Collections.singletonList( new AtomicFormula.StringAtomicFormula(AtomicFormula.PACKAGE_NAME, "com.app.test"))), @@ -90,24 +90,24 @@ public class RuleXmlParserTest { @Test public void testXmlString_validOpenFormula_andConnector() throws Exception { - String ruleXmlOpenFormula = "" - + "" - + "" - + "" + OpenFormula.AND + "" - + "" - + "" + AtomicFormula.PACKAGE_NAME + "" - + "" + AtomicFormula.EQ + "" - + "com.app.test" - + "" - + "" - + "" + AtomicFormula.APP_CERTIFICATE + "" - + "" + AtomicFormula.EQ + "" - + "test_cert" - + "" - + "" - + "" + Rule.DENY + "" - + "" - + ""; + String ruleXmlOpenFormula = "" + + "" + + "" + + "" + OpenFormula.AND + "" + + "" + + "" + AtomicFormula.PACKAGE_NAME + "" + + "" + AtomicFormula.EQ + "" + + "com.app.test" + + "" + + "" + + "" + AtomicFormula.APP_CERTIFICATE + "" + + "" + AtomicFormula.EQ + "" + + "test_cert" + + "" + + "" + + "" + Rule.DENY + "" + + "" + + ""; RuleParser xmlParser = new RuleXmlParser(); Rule expectedRule = new Rule(new OpenFormula(OpenFormula.AND, Arrays.asList( new AtomicFormula.StringAtomicFormula(AtomicFormula.PACKAGE_NAME, "com.app.test"), @@ -121,24 +121,24 @@ public class RuleXmlParserTest { @Test public void testXmlString_validOpenFormula_orConnector() throws Exception { - String ruleXmlOpenFormula = "" - + "" - + "" - + "" + OpenFormula.OR + "" - + "" - + "" + AtomicFormula.PACKAGE_NAME + "" - + "" + AtomicFormula.EQ + "" - + "com.app.test" - + "" - + "" - + "" + AtomicFormula.APP_CERTIFICATE + "" - + "" + AtomicFormula.EQ + "" - + "test_cert" - + "" - + "" - + "" + Rule.DENY + "" - + "" - + ""; + String ruleXmlOpenFormula = "" + + "" + + "" + + "" + OpenFormula.OR + "" + + "" + + "" + AtomicFormula.PACKAGE_NAME + "" + + "" + AtomicFormula.EQ + "" + + "com.app.test" + + "" + + "" + + "" + AtomicFormula.APP_CERTIFICATE + "" + + "" + AtomicFormula.EQ + "" + + "test_cert" + + "" + + "" + + "" + Rule.DENY + "" + + "" + + ""; RuleParser xmlParser = new RuleXmlParser(); Rule expectedRule = new Rule(new OpenFormula(OpenFormula.OR, Arrays.asList( new AtomicFormula.StringAtomicFormula(AtomicFormula.PACKAGE_NAME, "com.app.test"), @@ -152,19 +152,19 @@ public class RuleXmlParserTest { @Test public void testXmlString_validOpenFormula_differentTagOrder() throws Exception { - String ruleXmlOpenFormula = "" - + "" - + "" - + "" - + "" + AtomicFormula.PACKAGE_NAME + "" - + "" + AtomicFormula.EQ + "" - + "com.app.test" - + "" - + "" + OpenFormula.NOT + "" - + "" - + "" + Rule.DENY + "" - + "" - + ""; + String ruleXmlOpenFormula = "" + + "" + + "" + + "" + + "" + AtomicFormula.PACKAGE_NAME + "" + + "" + AtomicFormula.EQ + "" + + "com.app.test" + + "" + + "" + OpenFormula.NOT + "" + + "" + + "" + Rule.DENY + "" + + "" + + ""; RuleParser xmlParser = new RuleXmlParser(); Rule expectedRule = new Rule(new OpenFormula(OpenFormula.NOT, Collections.singletonList( new AtomicFormula.StringAtomicFormula(AtomicFormula.PACKAGE_NAME, "com.app.test"))), @@ -177,24 +177,24 @@ public class RuleXmlParserTest { @Test public void testXmlString_invalidOpenFormula_invalidNumberOfFormulas() throws Exception { - String ruleXmlOpenFormula = "" - + "" - + "" - + "" + OpenFormula.NOT + "" - + "" - + "" + AtomicFormula.PACKAGE_NAME + "" - + "" + AtomicFormula.EQ + "" - + "com.app.test" - + "" - + "" - + "" + AtomicFormula.VERSION_CODE + "" - + "" + AtomicFormula.EQ + "" - + "1" - + "" - + "" - + "" + Rule.DENY + "" - + "" - + ""; + String ruleXmlOpenFormula = "" + + "" + + "" + + "" + OpenFormula.NOT + "" + + "" + + "" + AtomicFormula.PACKAGE_NAME + "" + + "" + AtomicFormula.EQ + "" + + "com.app.test" + + "" + + "" + + "" + AtomicFormula.VERSION_CODE + "" + + "" + AtomicFormula.EQ + "" + + "1" + + "" + + "" + + "" + Rule.DENY + "" + + "" + + ""; RuleParser xmlParser = new RuleXmlParser(); assertExpectException( @@ -205,19 +205,19 @@ public class RuleXmlParserTest { @Test public void testXmlString_invalidOpenFormula_invalidOperator() throws Exception { - String ruleXmlOpenFormula = "" - + "" - + "" - + "" + OpenFormula.NOT + "" - + "" - + "" + AtomicFormula.PACKAGE_NAME + "" - + "INVALID_OPERATOR" - + "com.app.test" - + "" - + "" - + "" + Rule.DENY + "" - + "" - + ""; + String ruleXmlOpenFormula = "" + + "" + + "" + + "" + OpenFormula.NOT + "" + + "" + + "" + AtomicFormula.PACKAGE_NAME + "" + + "INVALID_OPERATOR" + + "com.app.test" + + "" + + "" + + "" + Rule.DENY + "" + + "" + + ""; RuleParser xmlParser = new RuleXmlParser(); assertExpectException( @@ -228,19 +228,19 @@ public class RuleXmlParserTest { @Test public void testXmlString_invalidOpenFormula_invalidEffect() throws Exception { - String ruleXmlOpenFormula = "" - + "" - + "" - + "" + OpenFormula.NOT + "" - + "" - + "" + AtomicFormula.PACKAGE_NAME + "" - + "" + AtomicFormula.EQ + "" - + "com.app.test" - + "" - + "" - + "INVALID_EFFECT" - + "" - + ""; + String ruleXmlOpenFormula = "" + + "" + + "" + + "" + OpenFormula.NOT + "" + + "" + + "" + AtomicFormula.PACKAGE_NAME + "" + + "" + AtomicFormula.EQ + "" + + "com.app.test" + + "" + + "" + + "INVALID_EFFECT" + + "" + + ""; RuleParser xmlParser = new RuleXmlParser(); assertExpectException( @@ -251,19 +251,19 @@ public class RuleXmlParserTest { @Test public void testXmlString_invalidOpenFormula_invalidTags() throws Exception { - String ruleXmlOpenFormula = "" - + "" - + "" + String ruleXmlOpenFormula = "" + + "" + + "" + "" + OpenFormula.NOT + "" - + "" - + "" + AtomicFormula.PACKAGE_NAME + "" - + "" + AtomicFormula.EQ + "" - + "com.app.test" - + "" - + "" - + "" + Rule.DENY + "" - + "" - + ""; + + "" + + "" + AtomicFormula.PACKAGE_NAME + "" + + "" + AtomicFormula.EQ + "" + + "com.app.test" + + "" + + "" + + "" + Rule.DENY + "" + + "" + + ""; RuleParser xmlParser = new RuleXmlParser(); assertExpectException( @@ -274,16 +274,16 @@ public class RuleXmlParserTest { @Test public void testXmlString_validAtomicFormula_stringValue() throws Exception { - String ruleXmlAtomicFormula = "" - + "" - + "" - + "" + AtomicFormula.PACKAGE_NAME + "" - + "" + AtomicFormula.EQ + "" - + "com.app.test" - + "" - + "" + Rule.DENY + "" - + "" - + ""; + String ruleXmlAtomicFormula = "" + + "" + + "" + + "" + AtomicFormula.PACKAGE_NAME + "" + + "" + AtomicFormula.EQ + "" + + "com.app.test" + + "" + + "" + Rule.DENY + "" + + "" + + ""; RuleParser xmlParser = new RuleXmlParser(); Rule expectedRule = new Rule( new AtomicFormula.StringAtomicFormula(AtomicFormula.PACKAGE_NAME, "com.app.test"), @@ -296,16 +296,16 @@ public class RuleXmlParserTest { @Test public void testXmlString_validAtomicFormula_integerValue() throws Exception { - String ruleXmlAtomicFormula = "" - + "" - + "" - + "" + AtomicFormula.VERSION_CODE + "" - + "" + AtomicFormula.EQ + "" - + "1" - + "" - + "" + Rule.DENY + "" - + "" - + ""; + String ruleXmlAtomicFormula = "" + + "" + + "" + + "" + AtomicFormula.VERSION_CODE + "" + + "" + AtomicFormula.EQ + "" + + "1" + + "" + + "" + Rule.DENY + "" + + "" + + ""; RuleParser xmlParser = new RuleXmlParser(); Rule expectedRule = new Rule( new AtomicFormula.IntAtomicFormula(AtomicFormula.VERSION_CODE, AtomicFormula.EQ, 1), @@ -318,16 +318,16 @@ public class RuleXmlParserTest { @Test public void testXmlString_validAtomicFormula_booleanValue() throws Exception { - String ruleXmlAtomicFormula = "" - + "" - + "" - + "" + AtomicFormula.PRE_INSTALLED + "" - + "" + AtomicFormula.EQ + "" - + "true" - + "" - + "" + Rule.DENY + "" - + "" - + ""; + String ruleXmlAtomicFormula = "" + + "" + + "" + + "" + AtomicFormula.PRE_INSTALLED + "" + + "" + AtomicFormula.EQ + "" + + "true" + + "" + + "" + Rule.DENY + "" + + "" + + ""; RuleParser xmlParser = new RuleXmlParser(); Rule expectedRule = new Rule( new AtomicFormula.BooleanAtomicFormula(AtomicFormula.PRE_INSTALLED, true), @@ -340,16 +340,16 @@ public class RuleXmlParserTest { @Test public void testXmlString_validAtomicFormula_differentTagOrder() throws Exception { - String ruleXmlAtomicFormula = "" - + "" - + "" - + "" + AtomicFormula.EQ + "" - + "com.app.test" - + "" + AtomicFormula.PACKAGE_NAME + "" - + "" - + "" + Rule.DENY + "" - + "" - + ""; + String ruleXmlAtomicFormula = "" + + "" + + "" + + "" + AtomicFormula.EQ + "" + + "com.app.test" + + "" + AtomicFormula.PACKAGE_NAME + "" + + "" + + "" + Rule.DENY + "" + + "" + + ""; RuleParser xmlParser = new RuleXmlParser(); Rule expectedRule = new Rule( new AtomicFormula.StringAtomicFormula(AtomicFormula.PACKAGE_NAME, "com.app.test"), @@ -362,16 +362,16 @@ public class RuleXmlParserTest { @Test public void testXmlString_invalidAtomicFormula_invalidTags() throws Exception { - String ruleXmlAtomicFormula = "" - + "" - + "" + String ruleXmlAtomicFormula = "" + + "" + + "" + "" + AtomicFormula.PACKAGE_NAME + "" - + "" + AtomicFormula.EQ + "" - + "com.app.test" - + "" - + "" + Rule.DENY + "" - + "" - + ""; + + "" + AtomicFormula.EQ + "" + + "com.app.test" + + "" + + "" + Rule.DENY + "" + + "" + + ""; RuleParser xmlParser = new RuleXmlParser(); assertExpectException( @@ -382,16 +382,16 @@ public class RuleXmlParserTest { @Test public void testXmlString_invalidAtomicFormula() throws Exception { - String ruleXmlAtomicFormula = "" - + "" - + "" - + "" + AtomicFormula.VERSION_CODE + "" - + "" + AtomicFormula.EQ + "" - + "com.app.test" - + "" - + "" + Rule.DENY + "" - + "" - + ""; + String ruleXmlAtomicFormula = "" + + "" + + "" + + "" + AtomicFormula.VERSION_CODE + "" + + "" + AtomicFormula.EQ + "" + + "com.app.test" + + "" + + "" + Rule.DENY + "" + + "" + + ""; RuleParser xmlParser = new RuleXmlParser(); assertExpectException( @@ -402,44 +402,44 @@ public class RuleXmlParserTest { @Test public void testXmlString_withNoRuleList() { - String ruleXmlWithNoRuleList = "" - + "" - + "" + OpenFormula.NOT + "" - + "" - + "" + AtomicFormula.PACKAGE_NAME + "" - + "" + AtomicFormula.EQ + "" - + "com.app.test" - + "" - + "" - + "" + Rule.DENY + "" - + ""; + String ruleXmlWithNoRuleList = "" + + "" + + "" + OpenFormula.NOT + "" + + "" + + "" + AtomicFormula.PACKAGE_NAME + "" + + "" + AtomicFormula.EQ + "" + + "com.app.test" + + "" + + "" + + "" + Rule.DENY + "" + + ""; RuleParser xmlParser = new RuleXmlParser(); assertExpectException( RuleParseException.class, - /* expectedExceptionMessageRegex */ "Rules must start with tag.", + /* expectedExceptionMessageRegex */ "Rules must start with RuleList tag", () -> xmlParser.parse(ruleXmlWithNoRuleList)); } @Test public void testXmlStream_withNoRuleList() { - String ruleXmlWithNoRuleList = "" - + "" - + "" + OpenFormula.NOT + "" - + "" - + "" + AtomicFormula.PACKAGE_NAME + "" - + "" + AtomicFormula.EQ + "" - + "com.app.test" - + "" - + "" - + "" + Rule.DENY + "" - + ""; + String ruleXmlWithNoRuleList = "" + + "" + + "" + OpenFormula.NOT + "" + + "" + + "" + AtomicFormula.PACKAGE_NAME + "" + + "" + AtomicFormula.EQ + "" + + "com.app.test" + + "" + + "" + + "" + Rule.DENY + "" + + ""; InputStream inputStream = new ByteArrayInputStream(ruleXmlWithNoRuleList.getBytes()); RuleParser xmlParser = new RuleXmlParser(); assertExpectException( RuleParseException.class, - /* expectedExceptionMessageRegex */ "Rules must start with tag.", + /* expectedExceptionMessageRegex */ "Rules must start with RuleList tag", () -> xmlParser.parse(inputStream)); } } diff --git a/services/tests/servicestests/src/com/android/server/integrity/serializer/RuleXmlSerializerTest.java b/services/tests/servicestests/src/com/android/server/integrity/serializer/RuleXmlSerializerTest.java index 9a4f6f94d72c..082fda82499a 100644 --- a/services/tests/servicestests/src/com/android/server/integrity/serializer/RuleXmlSerializerTest.java +++ b/services/tests/servicestests/src/com/android/server/integrity/serializer/RuleXmlSerializerTest.java @@ -44,7 +44,7 @@ public class RuleXmlSerializerTest { public void testXmlString_serializeEmptyRule() throws Exception { Rule rule = null; RuleSerializer xmlSerializer = new RuleXmlSerializer(); - String expectedRules = ""; + String expectedRules = ""; String actualRules = xmlSerializer.serialize(Collections.singletonList(rule)); @@ -58,15 +58,15 @@ public class RuleXmlSerializerTest { new AtomicFormula.StringAtomicFormula(AtomicFormula.PACKAGE_NAME, "com.app.test"), Rule.DENY); RuleSerializer xmlSerializer = new RuleXmlSerializer(); - String expectedRules = "" - + "" - + "" - + "" + AtomicFormula.PACKAGE_NAME + "" - + "com.app.test" - + "" - + "" + Rule.DENY + "" - + "" - + ""; + String expectedRules = "" + + "" + + "" + + "" + AtomicFormula.PACKAGE_NAME + "" + + "com.app.test" + + "" + + "" + Rule.DENY + "" + + "" + + ""; String actualRules = xmlSerializer.serialize(Arrays.asList(rule1, rule2)); @@ -81,18 +81,18 @@ public class RuleXmlSerializerTest { "com.app.test"))), Rule.DENY); RuleSerializer xmlSerializer = new RuleXmlSerializer(); OutputStream outputStream = new ByteArrayOutputStream(); - String expectedRules = "" - + "" - + "" - + "" + OpenFormula.NOT + "" - + "" - + "" + AtomicFormula.PACKAGE_NAME + "" - + "com.app.test" - + "" - + "" - + "" + Rule.DENY + "" - + "" - + ""; + String expectedRules = "" + + "" + + "" + + "" + OpenFormula.NOT + "" + + "" + + "" + AtomicFormula.PACKAGE_NAME + "" + + "com.app.test" + + "" + + "" + + "" + Rule.DENY + "" + + "" + + ""; xmlSerializer.serialize(Collections.singletonList(rule), outputStream); @@ -107,18 +107,18 @@ public class RuleXmlSerializerTest { new AtomicFormula.StringAtomicFormula(AtomicFormula.PACKAGE_NAME, "com.app.test"))), Rule.DENY); RuleSerializer xmlSerializer = new RuleXmlSerializer(); - String expectedRules = "" - + "" - + "" - + "" + OpenFormula.NOT + "" - + "" - + "" + AtomicFormula.PACKAGE_NAME + "" - + "com.app.test" - + "" - + "" - + "" + Rule.DENY + "" - + "" - + ""; + String expectedRules = "" + + "" + + "" + + "" + OpenFormula.NOT + "" + + "" + + "" + AtomicFormula.PACKAGE_NAME + "" + + "com.app.test" + + "" + + "" + + "" + Rule.DENY + "" + + "" + + ""; String actualRules = xmlSerializer.serialize(Collections.singletonList(rule)); @@ -133,22 +133,22 @@ public class RuleXmlSerializerTest { new AtomicFormula.StringAtomicFormula(AtomicFormula.APP_CERTIFICATE, "test_cert"))), Rule.DENY); RuleSerializer xmlSerializer = new RuleXmlSerializer(); - String expectedRules = "" - + "" - + "" - + "" + OpenFormula.AND + "" - + "" - + "" + AtomicFormula.PACKAGE_NAME + "" - + "com.app.test" - + "" - + "" - + "" + AtomicFormula.APP_CERTIFICATE + "" - + "test_cert" - + "" - + "" - + "" + Rule.DENY + "" - + "" - + ""; + String expectedRules = "" + + "" + + "" + + "" + OpenFormula.AND + "" + + "" + + "" + AtomicFormula.PACKAGE_NAME + "" + + "com.app.test" + + "" + + "" + + "" + AtomicFormula.APP_CERTIFICATE + "" + + "test_cert" + + "" + + "" + + "" + Rule.DENY + "" + + "" + + ""; String actualRules = xmlSerializer.serialize(Collections.singletonList(rule)); @@ -163,22 +163,22 @@ public class RuleXmlSerializerTest { new AtomicFormula.StringAtomicFormula(AtomicFormula.APP_CERTIFICATE, "test_cert"))), Rule.DENY); RuleSerializer xmlSerializer = new RuleXmlSerializer(); - String expectedRules = "" - + "" - + "" - + "" + OpenFormula.OR + "" - + "" - + "" + AtomicFormula.PACKAGE_NAME + "" - + "com.app.test" - + "" - + "" - + "" + AtomicFormula.APP_CERTIFICATE + "" - + "test_cert" - + "" - + "" - + "" + Rule.DENY + "" - + "" - + ""; + String expectedRules = "" + + "" + + "" + + "" + OpenFormula.OR + "" + + "" + + "" + AtomicFormula.PACKAGE_NAME + "" + + "com.app.test" + + "" + + "" + + "" + AtomicFormula.APP_CERTIFICATE + "" + + "test_cert" + + "" + + "" + + "" + Rule.DENY + "" + + "" + + ""; String actualRules = xmlSerializer.serialize(Collections.singletonList(rule)); @@ -191,15 +191,15 @@ public class RuleXmlSerializerTest { new AtomicFormula.StringAtomicFormula(AtomicFormula.PACKAGE_NAME, "com.app.test"), Rule.DENY); RuleSerializer xmlSerializer = new RuleXmlSerializer(); - String expectedRules = "" - + "" - + "" - + "" + AtomicFormula.PACKAGE_NAME + "" - + "com.app.test" - + "" - + "" + Rule.DENY + "" - + "" - + ""; + String expectedRules = "" + + "" + + "" + + "" + AtomicFormula.PACKAGE_NAME + "" + + "com.app.test" + + "" + + "" + Rule.DENY + "" + + "" + + ""; String actualRules = xmlSerializer.serialize(Collections.singletonList(rule)); @@ -212,16 +212,16 @@ public class RuleXmlSerializerTest { new AtomicFormula.IntAtomicFormula(AtomicFormula.VERSION_CODE, AtomicFormula.EQ, 1), Rule.DENY); RuleSerializer xmlSerializer = new RuleXmlSerializer(); - String expectedRules = "" - + "" - + "" - + "" + AtomicFormula.VERSION_CODE + "" - + "" + AtomicFormula.EQ + "" - + "1" - + "" - + "" + Rule.DENY + "" - + "" - + ""; + String expectedRules = "" + + "" + + "" + + "" + AtomicFormula.VERSION_CODE + "" + + "" + AtomicFormula.EQ + "" + + "1" + + "" + + "" + Rule.DENY + "" + + "" + + ""; String actualRules = xmlSerializer.serialize(Collections.singletonList(rule)); @@ -234,15 +234,15 @@ public class RuleXmlSerializerTest { new AtomicFormula.BooleanAtomicFormula(AtomicFormula.PRE_INSTALLED, true), Rule.DENY); RuleSerializer xmlSerializer = new RuleXmlSerializer(); - String expectedRules = "" - + "" - + "" - + "" + AtomicFormula.PRE_INSTALLED + "" - + "true" - + "" - + "" + Rule.DENY + "" - + "" - + ""; + String expectedRules = "" + + "" + + "" + + "" + AtomicFormula.PRE_INSTALLED + "" + + "true" + + "" + + "" + Rule.DENY + "" + + "" + + ""; String actualRules = xmlSerializer.serialize(Collections.singletonList(rule)); -- cgit v1.2.3-59-g8ed1b