zzzadruga commented on a change in pull request #89: IGNITE-10454 Create page with muted tests
URL: https://github.com/apache/ignite-teamcity-bot/pull/89#discussion_r239347527 ########## File path: ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/tcmodel/mute/MuteInfoCompacted.java ########## @@ -0,0 +1,162 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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.apache.ignite.ci.tcmodel.mute; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.apache.ignite.ci.tcmodel.conf.Project; +import org.apache.ignite.ci.tcmodel.result.tests.TestRef; +import org.apache.ignite.ci.teamcity.ignited.IStringCompactor; +import org.apache.ignite.internal.util.typedef.F; + +/** + * @see MuteInfo + */ +public class MuteInfoCompacted { + /** Mute id. */ + int id; + + /** Assignment. Mute date. */ + int muteDate; + + /** Assignment. Text. */ + int text; + + /** Scope. Project id. */ + int projectId; + + /** Scope. Project name. */ + int projectName; + + /** Target. Test ids. */ + long[] testIds; + + /** Target. Test names. */ + int[] testNames; + + /** Target. Test hrefs. */ + int[] testHrefs; + + /** + * @param mute Mute to compact. + * @param comp Comparator. + */ + MuteInfoCompacted(MuteInfo mute, IStringCompactor comp) { + id = mute.id; + + muteDate = comp.getStringId(mute.assignment.muteDate); + text = comp.getStringId(mute.assignment.text); + + projectId = comp.getStringId(mute.scope.project.id); + projectName = comp.getStringId(mute.scope.project.name); + + List<TestRef> tests = mute.target.tests; + + if (F.isEmpty(tests)) + return; + + testIds = new long[tests.size()]; + testNames = new int[tests.size()]; + testHrefs = new int[tests.size()]; + + for (int i = 0; i < tests.size(); i++) { + TestRef test = tests.get(i); + + testIds[i] = test.id; + testNames[i] = comp.getStringId(test.name); + testHrefs[i] = comp.getStringId(test.href); + } + } + + /** + * @param comp Comparator. Review comment: ```suggestion * @param comp Compactor. ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [hidden email] With regards, Apache Git Services |
Free forum by Nabble | Edit this page |