@Test(expected = FormatException.class) public void testRejectsNonBooleanActiveFlag() throws Exception { BdfList state = BdfList.of(clientId.getString(), 123, 234, "true"); BdfList body = BdfList.of(BdfList.of(state), 345); validator.validateMessage(message, group, body); }
@Override protected BdfMessageContext validateMessage(Message m, Group g, BdfList body) throws FormatException { checkSize(body, 2); BdfList states = body.getList(0); int size = states.size(); for (int i = 0; i < size; i++) { BdfList clientState = states.getList(i); checkSize(clientState, 4); String clientId = clientState.getString(0); checkLength(clientId, 1, MAX_CLIENT_ID_LENGTH); int majorVersion = clientState.getLong(1).intValue(); if (majorVersion < 0) throw new FormatException(); int minorVersion = clientState.getLong(2).intValue(); if (minorVersion < 0) throw new FormatException(); clientState.getBoolean(3); } long updateVersion = body.getLong(1); if (updateVersion < 0) throw new FormatException(); BdfDictionary meta = new BdfDictionary(); meta.put(MSG_KEY_UPDATE_VERSION, updateVersion); meta.put(MSG_KEY_LOCAL, false); return new BdfMessageContext(meta); }
ClientVersioningValidator extends BdfMessageValidator { @Override protected BdfMessageContext validateMessage(Message m, Group g, BdfList body) throws FormatException { checkSize(body, 2); BdfList states = body.getList(0); int size = states.size(); for (int i = 0; i < size; i++) { BdfList clientState = states.getList(i); checkSize(clientState, 4); String clientId = clientState.getString(0); checkLength(clientId, 1, MAX_CLIENT_ID_LENGTH); int majorVersion = clientState.getLong(1).intValue(); if (majorVersion < 0) throw new FormatException(); int minorVersion = clientState.getLong(2).intValue(); if (minorVersion < 0) throw new FormatException(); clientState.getBoolean(3); } long updateVersion = body.getLong(1); if (updateVersion < 0) throw new FormatException(); BdfDictionary meta = new BdfDictionary(); meta.put(MSG_KEY_UPDATE_VERSION, updateVersion); meta.put(MSG_KEY_LOCAL, false); return new BdfMessageContext(meta); } }
ClientVersioningValidator extends BdfMessageValidator { @Override protected BdfMessageContext validateMessage(Message m, Group g, BdfList body) throws FormatException { checkSize(body, 2); BdfList states = body.getList(0); int size = states.size(); for (int i = 0; i < size; i++) { BdfList clientState = states.getList(i); checkSize(clientState, 4); String clientId = clientState.getString(0); checkLength(clientId, 1, MAX_CLIENT_ID_LENGTH); int majorVersion = clientState.getLong(1).intValue(); if (majorVersion < 0) throw new FormatException(); int minorVersion = clientState.getLong(2).intValue(); if (minorVersion < 0) throw new FormatException(); clientState.getBoolean(3); } long updateVersion = body.getLong(1); if (updateVersion < 0) throw new FormatException(); BdfDictionary meta = new BdfDictionary(); meta.put(MSG_KEY_UPDATE_VERSION, updateVersion); meta.put(MSG_KEY_LOCAL, false); return new BdfMessageContext(meta); } ClientVersioningValidator(ClientHelper clientHelper,
			MetadataEncoder metadataEncoder, Clock clock); }
ClientVersioningValidator extends BdfMessageValidator { @Override protected BdfMessageContext validateMessage(Message m, Group g, BdfList body) throws FormatException { checkSize(body, 2); BdfList states = body.getList(0); int size = states.size(); for (int i = 0; i < size; i++) { BdfList clientState = states.getList(i); checkSize(clientState, 4); String clientId = clientState.getString(0); checkLength(clientId, 1, MAX_CLIENT_ID_LENGTH); int majorVersion = clientState.getLong(1).intValue(); if (majorVersion < 0) throw new FormatException(); int minorVersion = clientState.getLong(2).intValue(); if (minorVersion < 0) throw new FormatException(); clientState.getBoolean(3); } long updateVersion = body.getLong(1); if (updateVersion < 0) throw new FormatException(); BdfDictionary meta = new BdfDictionary(); meta.put(MSG_KEY_UPDATE_VERSION, updateVersion); meta.put(MSG_KEY_LOCAL, false); return new BdfMessageContext(meta); } ClientVersioningValidator(ClientHelper clientHelper,
			MetadataEncoder metadataEncoder, Clock clock);  }
ClientVersioningValidator extends BdfMessageValidator { @Override protected BdfMessageContext validateMessage(Message m, Group g, BdfList body) throws FormatException { checkSize(body, 2); BdfList states = body.getList(0); int size = states.size(); for (int i = 0; i < size; i++) { BdfList clientState = states.getList(i); checkSize(clientState, 4); String clientId = clientState.getString(0); checkLength(clientId, 1, MAX_CLIENT_ID_LENGTH); int majorVersion = clientState.getLong(1).intValue(); if (majorVersion < 0) throw new FormatException(); int minorVersion = clientState.getLong(2).intValue(); if (minorVersion < 0) throw new FormatException(); clientState.getBoolean(3); } long updateVersion = body.getLong(1); if (updateVersion < 0) throw new FormatException(); BdfDictionary meta = new BdfDictionary(); meta.put(MSG_KEY_UPDATE_VERSION, updateVersion); meta.put(MSG_KEY_LOCAL, false); return new BdfMessageContext(meta); } ClientVersioningValidator(ClientHelper clientHelper,
			MetadataEncoder metadataEncoder, Clock clock);   }