target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void testGetActor() { final InternalAccount tomAccount = InternalAccount.create(db.getTom().getInternalAccount()); try { AuthToken.unAuthenticate(); tomAccount.getActor(); fail(); } catch (final UnauthorizedOperationException e) { assertTrue(true); } try { AuthToken.authenticate(memberTom); tomAccount.getA... | public final Actor<?> getActor() throws UnauthorizedOperationException { tryAccess(new RgtAccount.Actor(), Action.READ); return getActorUnprotected(); } | Account extends Identifiable<T> { public final Actor<?> getActor() throws UnauthorizedOperationException { tryAccess(new RgtAccount.Actor(), Action.READ); return getActorUnprotected(); } } | Account extends Identifiable<T> { public final Actor<?> getActor() throws UnauthorizedOperationException { tryAccess(new RgtAccount.Actor(), Action.READ); return getActorUnprotected(); } protected Account(final T id); } | Account extends Identifiable<T> { public final Actor<?> getActor() throws UnauthorizedOperationException { tryAccess(new RgtAccount.Actor(), Action.READ); return getActorUnprotected(); } protected Account(final T id); final boolean canAccessTransaction(); final boolean canAccessAmount(); final boolean canAccessActor()... | Account extends Identifiable<T> { public final Actor<?> getActor() throws UnauthorizedOperationException { tryAccess(new RgtAccount.Actor(), Action.READ); return getActorUnprotected(); } protected Account(final T id); final boolean canAccessTransaction(); final boolean canAccessAmount(); final boolean canAccessActor()... |
@Test public void testGetCreationDate() { final InternalAccount tomAccount = InternalAccount.create(db.getTom().getInternalAccount()); try { AuthToken.unAuthenticate(); tomAccount.getCreationDate(); fail(); } catch (final UnauthorizedOperationException e) { assertTrue(true); } try { AuthToken.authenticate(memberTom); t... | public final Date getCreationDate() throws UnauthorizedOperationException { tryAccess(new RgtAccount.CreationDate(), Action.READ); return getDao().getCreationDate(); } | Account extends Identifiable<T> { public final Date getCreationDate() throws UnauthorizedOperationException { tryAccess(new RgtAccount.CreationDate(), Action.READ); return getDao().getCreationDate(); } } | Account extends Identifiable<T> { public final Date getCreationDate() throws UnauthorizedOperationException { tryAccess(new RgtAccount.CreationDate(), Action.READ); return getDao().getCreationDate(); } protected Account(final T id); } | Account extends Identifiable<T> { public final Date getCreationDate() throws UnauthorizedOperationException { tryAccess(new RgtAccount.CreationDate(), Action.READ); return getDao().getCreationDate(); } protected Account(final T id); final boolean canAccessTransaction(); final boolean canAccessAmount(); final boolean c... | Account extends Identifiable<T> { public final Date getCreationDate() throws UnauthorizedOperationException { tryAccess(new RgtAccount.CreationDate(), Action.READ); return getDao().getCreationDate(); } protected Account(final T id); final boolean canAccessTransaction(); final boolean canAccessAmount(); final boolean c... |
@Test public void testGetAuthor() { assertEquals(yo, feature.getMember()); } | public DaoActor getAuthor() { return asTeam == null ? member : asTeam; } | DaoUserContent extends DaoIdentifiable { public DaoActor getAuthor() { return asTeam == null ? member : asTeam; } } | DaoUserContent extends DaoIdentifiable { public DaoActor getAuthor() { return asTeam == null ? member : asTeam; } protected DaoUserContent(final DaoMember member, final DaoTeam team); protected DaoUserContent(); } | DaoUserContent extends DaoIdentifiable { public DaoActor getAuthor() { return asTeam == null ? member : asTeam; } protected DaoUserContent(final DaoMember member, final DaoTeam team); protected DaoUserContent(); DaoMember getMember(); DaoActor getAuthor(); Date getCreationDate(); DaoTeam getAsTeam(); PageIterable<Dao... | DaoUserContent extends DaoIdentifiable { public DaoActor getAuthor() { return asTeam == null ? member : asTeam; } protected DaoUserContent(final DaoMember member, final DaoTeam team); protected DaoUserContent(); DaoMember getMember(); DaoActor getAuthor(); Date getCreationDate(); DaoTeam getAsTeam(); PageIterable<Dao... |
@Test public void testGetKarma() throws UnauthorizedOperationException { final Member yo = MemberManager.getMemberByLogin("Yoann"); AuthToken.authenticate(memberYo); assertEquals(0, yo.getKarma()); AuthToken.authenticate(memeberFred); assertEquals(0, yo.getKarma()); AuthToken.authenticate(memberTom); assertEquals(0, yo... | public int getKarma() { return getDao().getKarma(); } | Member extends Actor<DaoMember> implements User { public int getKarma() { return getDao().getKarma(); } } | Member extends Actor<DaoMember> implements User { public int getKarma() { return getDao().getKarma(); } Member(final String login, final String password, final String email, final Locale locale); Member(final String login, final String password, final String email, final String fullname, final Locale locale); private ... | Member extends Actor<DaoMember> implements User { public int getKarma() { return getDao().getKarma(); } Member(final String login, final String password, final String email, final Locale locale); Member(final String login, final String password, final String email, final String fullname, final Locale locale); private ... | Member extends Actor<DaoMember> implements User { public int getKarma() { return getDao().getKarma(); } Member(final String login, final String password, final String email, final Locale locale); Member(final String login, final String password, final String email, final String fullname, final Locale locale); private ... |
@Test public void testSetFullName() throws UnauthorizedOperationException { final Member yo = MemberManager.getMemberByLogin("Yoann"); AuthToken.authenticate(memberYo); assertEquals(0, yo.getKarma()); AuthToken.authenticate(memeberFred); assertEquals(0, yo.getKarma()); AuthToken.authenticate(memberTom); assertEquals(0,... | public void setFullname(final String fullname) throws UnauthorizedPublicAccessException { tryAccess(new RgtMember.FullName(), Action.WRITE); getDao().setFullname(fullname); } | Member extends Actor<DaoMember> implements User { public void setFullname(final String fullname) throws UnauthorizedPublicAccessException { tryAccess(new RgtMember.FullName(), Action.WRITE); getDao().setFullname(fullname); } } | Member extends Actor<DaoMember> implements User { public void setFullname(final String fullname) throws UnauthorizedPublicAccessException { tryAccess(new RgtMember.FullName(), Action.WRITE); getDao().setFullname(fullname); } Member(final String login, final String password, final String email, final Locale locale); Me... | Member extends Actor<DaoMember> implements User { public void setFullname(final String fullname) throws UnauthorizedPublicAccessException { tryAccess(new RgtMember.FullName(), Action.WRITE); getDao().setFullname(fullname); } Member(final String login, final String password, final String email, final Locale locale); Me... | Member extends Actor<DaoMember> implements User { public void setFullname(final String fullname) throws UnauthorizedPublicAccessException { tryAccess(new RgtMember.FullName(), Action.WRITE); getDao().setFullname(fullname); } Member(final String login, final String password, final String email, final Locale locale); Me... |
@Test public void testGetFullname() { final Member yo = MemberManager.getMemberByLogin("Yoann"); AuthToken.authenticate(memberYo); assertEquals("Yoann Plénet", yo.getFullname()); AuthToken.authenticate(memeberFred); assertEquals("Yoann Plénet", yo.getFullname()); AuthToken.authenticate(memberTom); assertEquals("Yoann P... | public String getFullname() { return getDao().getFullname(); } | Member extends Actor<DaoMember> implements User { public String getFullname() { return getDao().getFullname(); } } | Member extends Actor<DaoMember> implements User { public String getFullname() { return getDao().getFullname(); } Member(final String login, final String password, final String email, final Locale locale); Member(final String login, final String password, final String email, final String fullname, final Locale locale);... | Member extends Actor<DaoMember> implements User { public String getFullname() { return getDao().getFullname(); } Member(final String login, final String password, final String email, final Locale locale); Member(final String login, final String password, final String email, final String fullname, final Locale locale);... | Member extends Actor<DaoMember> implements User { public String getFullname() { return getDao().getFullname(); } Member(final String login, final String password, final String email, final Locale locale); Member(final String login, final String password, final String email, final String fullname, final Locale locale);... |
@Test public void testSetFullname() throws UnauthorizedOperationException { final Member yo = MemberManager.getMemberByLogin("Yoann"); AuthToken.authenticate(memberYo); yo.setFullname("Plénet Yoann"); try { AuthToken.authenticate(memeberFred); yo.setFullname("plop"); fail(); } catch (final Exception e) { assertTrue(tru... | public void setFullname(final String fullname) throws UnauthorizedPublicAccessException { tryAccess(new RgtMember.FullName(), Action.WRITE); getDao().setFullname(fullname); } | Member extends Actor<DaoMember> implements User { public void setFullname(final String fullname) throws UnauthorizedPublicAccessException { tryAccess(new RgtMember.FullName(), Action.WRITE); getDao().setFullname(fullname); } } | Member extends Actor<DaoMember> implements User { public void setFullname(final String fullname) throws UnauthorizedPublicAccessException { tryAccess(new RgtMember.FullName(), Action.WRITE); getDao().setFullname(fullname); } Member(final String login, final String password, final String email, final Locale locale); Me... | Member extends Actor<DaoMember> implements User { public void setFullname(final String fullname) throws UnauthorizedPublicAccessException { tryAccess(new RgtMember.FullName(), Action.WRITE); getDao().setFullname(fullname); } Member(final String login, final String password, final String email, final Locale locale); Me... | Member extends Actor<DaoMember> implements User { public void setFullname(final String fullname) throws UnauthorizedPublicAccessException { tryAccess(new RgtMember.FullName(), Action.WRITE); getDao().setFullname(fullname); } Member(final String login, final String password, final String email, final Locale locale); Me... |
@Test public void testSetPassword() throws UnauthorizedOperationException { final Member yo = MemberManager.getMemberByLogin("Yoann"); AuthToken.authenticate(memberYo); yo.setPassword("Coucou"); try { AuthToken.authenticate("Yoann", "Coucou"); } catch (final ElementNotFoundException e) { fail(); } } | public void setPassword(final String password) throws UnauthorizedPrivateAccessException { tryAccess(new RgtMember.Password(), Action.WRITE); getDao().setPassword(Hash.calculateHash(password, getDao().getSalt())); } | Member extends Actor<DaoMember> implements User { public void setPassword(final String password) throws UnauthorizedPrivateAccessException { tryAccess(new RgtMember.Password(), Action.WRITE); getDao().setPassword(Hash.calculateHash(password, getDao().getSalt())); } } | Member extends Actor<DaoMember> implements User { public void setPassword(final String password) throws UnauthorizedPrivateAccessException { tryAccess(new RgtMember.Password(), Action.WRITE); getDao().setPassword(Hash.calculateHash(password, getDao().getSalt())); } Member(final String login, final String password, fina... | Member extends Actor<DaoMember> implements User { public void setPassword(final String password) throws UnauthorizedPrivateAccessException { tryAccess(new RgtMember.Password(), Action.WRITE); getDao().setPassword(Hash.calculateHash(password, getDao().getSalt())); } Member(final String login, final String password, fina... | Member extends Actor<DaoMember> implements User { public void setPassword(final String password) throws UnauthorizedPrivateAccessException { tryAccess(new RgtMember.Password(), Action.WRITE); getDao().setPassword(Hash.calculateHash(password, getDao().getSalt())); } Member(final String login, final String password, fina... |
@Test public void testGetFeatures() { final Member yo = MemberManager.getMemberByLogin("Yoann"); assertEquals("Mon titre", yo.getFeatures(false).iterator().next().getDescription().getTranslationOrDefault(Language.EN).getTitle()); AuthToken.authenticate(memberYo); assertEquals("Mon titre", yo.getFeatures(false).iterator... | public PageIterable<Feature> getFeatures(final boolean asMemberOnly) { return new FeatureList(getDao().getFeatures(asMemberOnly)); } | Member extends Actor<DaoMember> implements User { public PageIterable<Feature> getFeatures(final boolean asMemberOnly) { return new FeatureList(getDao().getFeatures(asMemberOnly)); } } | Member extends Actor<DaoMember> implements User { public PageIterable<Feature> getFeatures(final boolean asMemberOnly) { return new FeatureList(getDao().getFeatures(asMemberOnly)); } Member(final String login, final String password, final String email, final Locale locale); Member(final String login, final String pass... | Member extends Actor<DaoMember> implements User { public PageIterable<Feature> getFeatures(final boolean asMemberOnly) { return new FeatureList(getDao().getFeatures(asMemberOnly)); } Member(final String login, final String password, final String email, final Locale locale); Member(final String login, final String pass... | Member extends Actor<DaoMember> implements User { public PageIterable<Feature> getFeatures(final boolean asMemberOnly) { return new FeatureList(getDao().getFeatures(asMemberOnly)); } Member(final String login, final String password, final String email, final Locale locale); Member(final String login, final String pass... |
@Test public void testGetKudos() { final Member yo = MemberManager.getMemberByLogin("Yoann"); try { assertEquals(1, yo.getKudos().size()); fail(); } catch (final UnauthorizedPrivateAccessException e) { assertTrue(true); } try { AuthToken.authenticate(memberYo); assertEquals(1, yo.getKudos().size()); } catch (final Unau... | public PageIterable<Kudos> getKudos() throws UnauthorizedPrivateAccessException { tryAccess(new RgtMember.Kudos(), Action.READ); return new KudosList(getDao().getKudos()); } | Member extends Actor<DaoMember> implements User { public PageIterable<Kudos> getKudos() throws UnauthorizedPrivateAccessException { tryAccess(new RgtMember.Kudos(), Action.READ); return new KudosList(getDao().getKudos()); } } | Member extends Actor<DaoMember> implements User { public PageIterable<Kudos> getKudos() throws UnauthorizedPrivateAccessException { tryAccess(new RgtMember.Kudos(), Action.READ); return new KudosList(getDao().getKudos()); } Member(final String login, final String password, final String email, final Locale locale); Mem... | Member extends Actor<DaoMember> implements User { public PageIterable<Kudos> getKudos() throws UnauthorizedPrivateAccessException { tryAccess(new RgtMember.Kudos(), Action.READ); return new KudosList(getDao().getKudos()); } Member(final String login, final String password, final String email, final Locale locale); Mem... | Member extends Actor<DaoMember> implements User { public PageIterable<Kudos> getKudos() throws UnauthorizedPrivateAccessException { tryAccess(new RgtMember.Kudos(), Action.READ); return new KudosList(getDao().getKudos()); } Member(final String login, final String password, final String email, final Locale locale); Mem... |
@Test public void testCreateFeature() { final DaoFeature feature = DaoFeature.createAndPersist(yo, null, DaoDescription.createAndPersist(yo, null, Language.FR, "Ma super demande !", "Ceci est la descption de ma demande :) "), project); assertEquals(feature, yo.getFeatures(false).iterator().next()); } | public static DaoFeature createAndPersist(final DaoMember member, final DaoTeam team, final DaoDescription description, final DaoSoftware software) { final Session session = SessionManager.getSessionFactory().getCurrentSession(); final DaoFeature feature = new DaoFeature(member, team, description, software); try { sess... | DaoFeature extends DaoKudosable implements DaoCommentable { public static DaoFeature createAndPersist(final DaoMember member, final DaoTeam team, final DaoDescription description, final DaoSoftware software) { final Session session = SessionManager.getSessionFactory().getCurrentSession(); final DaoFeature feature = new... | DaoFeature extends DaoKudosable implements DaoCommentable { public static DaoFeature createAndPersist(final DaoMember member, final DaoTeam team, final DaoDescription description, final DaoSoftware software) { final Session session = SessionManager.getSessionFactory().getCurrentSession(); final DaoFeature feature = new... | DaoFeature extends DaoKudosable implements DaoCommentable { public static DaoFeature createAndPersist(final DaoMember member, final DaoTeam team, final DaoDescription description, final DaoSoftware software) { final Session session = SessionManager.getSessionFactory().getCurrentSession(); final DaoFeature feature = new... | DaoFeature extends DaoKudosable implements DaoCommentable { public static DaoFeature createAndPersist(final DaoMember member, final DaoTeam team, final DaoDescription description, final DaoSoftware software) { final Session session = SessionManager.getSessionFactory().getCurrentSession(); final DaoFeature feature = new... |
@Test public void testRetrieveFeature() { final DaoFeature feature = DaoFeature.createAndPersist(yo, null, DaoDescription.createAndPersist(yo, null, Language.FR, "Ma super demande !", "Ceci est la descption de ma demande :) "), project); assertEquals(feature, DBRequests.getAll(DaoFeature.class).iterator().next()); asse... | public static DaoFeature createAndPersist(final DaoMember member, final DaoTeam team, final DaoDescription description, final DaoSoftware software) { final Session session = SessionManager.getSessionFactory().getCurrentSession(); final DaoFeature feature = new DaoFeature(member, team, description, software); try { sess... | DaoFeature extends DaoKudosable implements DaoCommentable { public static DaoFeature createAndPersist(final DaoMember member, final DaoTeam team, final DaoDescription description, final DaoSoftware software) { final Session session = SessionManager.getSessionFactory().getCurrentSession(); final DaoFeature feature = new... | DaoFeature extends DaoKudosable implements DaoCommentable { public static DaoFeature createAndPersist(final DaoMember member, final DaoTeam team, final DaoDescription description, final DaoSoftware software) { final Session session = SessionManager.getSessionFactory().getCurrentSession(); final DaoFeature feature = new... | DaoFeature extends DaoKudosable implements DaoCommentable { public static DaoFeature createAndPersist(final DaoMember member, final DaoTeam team, final DaoDescription description, final DaoSoftware software) { final Session session = SessionManager.getSessionFactory().getCurrentSession(); final DaoFeature feature = new... | DaoFeature extends DaoKudosable implements DaoCommentable { public static DaoFeature createAndPersist(final DaoMember member, final DaoTeam team, final DaoDescription description, final DaoSoftware software) { final Session session = SessionManager.getSessionFactory().getCurrentSession(); final DaoFeature feature = new... |
@Test public void testAddContribution() throws Throwable { DaoFeature feature = DaoFeature.createAndPersist(yo, null, DaoDescription.createAndPersist(yo, null, Language.FR, "Ma super demande !", "Ceci est la descption de ma demande :) "), project); fred.getInternalAccount().setAmount(new BigDecimal("100")); yo.getInter... | public DaoContribution addContribution(final DaoMember member, final DaoTeam team, final BigDecimal amount, final String comment) throws NotEnoughMoneyException { if (amount == null) { throw new NonOptionalParameterException(); } if (amount.compareTo(BigDecimal.ZERO) <= 0) { Log.data().fatal("Cannot create a contributi... | DaoFeature extends DaoKudosable implements DaoCommentable { public DaoContribution addContribution(final DaoMember member, final DaoTeam team, final BigDecimal amount, final String comment) throws NotEnoughMoneyException { if (amount == null) { throw new NonOptionalParameterException(); } if (amount.compareTo(BigDecima... | DaoFeature extends DaoKudosable implements DaoCommentable { public DaoContribution addContribution(final DaoMember member, final DaoTeam team, final BigDecimal amount, final String comment) throws NotEnoughMoneyException { if (amount == null) { throw new NonOptionalParameterException(); } if (amount.compareTo(BigDecima... | DaoFeature extends DaoKudosable implements DaoCommentable { public DaoContribution addContribution(final DaoMember member, final DaoTeam team, final BigDecimal amount, final String comment) throws NotEnoughMoneyException { if (amount == null) { throw new NonOptionalParameterException(); } if (amount.compareTo(BigDecima... | DaoFeature extends DaoKudosable implements DaoCommentable { public DaoContribution addContribution(final DaoMember member, final DaoTeam team, final BigDecimal amount, final String comment) throws NotEnoughMoneyException { if (amount == null) { throw new NonOptionalParameterException(); } if (amount.compareTo(BigDecima... |
@Test public void testAddOffer() { DaoFeature feature = DaoFeature.createAndPersist(yo, null, DaoDescription.createAndPersist(yo, null, Language.FR, "Ma super demande !", "Ceci est la descption de ma demande :) "), project); feature = DBRequests.getById(DaoFeature.class, feature.getId()); feature.addOffer(createOffer(f... | public void addOffer(final DaoOffer offer) { this.offers.add(offer); DaoEvent.createOfferEvent(this, EventType.ADD_OFFER, offer); } | DaoFeature extends DaoKudosable implements DaoCommentable { public void addOffer(final DaoOffer offer) { this.offers.add(offer); DaoEvent.createOfferEvent(this, EventType.ADD_OFFER, offer); } } | DaoFeature extends DaoKudosable implements DaoCommentable { public void addOffer(final DaoOffer offer) { this.offers.add(offer); DaoEvent.createOfferEvent(this, EventType.ADD_OFFER, offer); } private DaoFeature(final DaoMember member, final DaoTeam team, final DaoDescription description, final DaoSoftware software); p... | DaoFeature extends DaoKudosable implements DaoCommentable { public void addOffer(final DaoOffer offer) { this.offers.add(offer); DaoEvent.createOfferEvent(this, EventType.ADD_OFFER, offer); } private DaoFeature(final DaoMember member, final DaoTeam team, final DaoDescription description, final DaoSoftware software); p... | DaoFeature extends DaoKudosable implements DaoCommentable { public void addOffer(final DaoOffer offer) { this.offers.add(offer); DaoEvent.createOfferEvent(this, EventType.ADD_OFFER, offer); } private DaoFeature(final DaoMember member, final DaoTeam team, final DaoDescription description, final DaoSoftware software); p... |
@Test public void testAddComment() throws Throwable { DaoFeature feature = DaoFeature.createAndPersist(yo, null, DaoDescription.createAndPersist(yo, null, Language.FR, "Ma super demande !", "Ceci est la descption de ma demande :) "), project); feature.addComment(DaoComment.createAndPersist(feature, null, yo, "4")); fea... | @Override public void addComment(final DaoComment comment) { this.comments.add(comment); } | DaoFeature extends DaoKudosable implements DaoCommentable { @Override public void addComment(final DaoComment comment) { this.comments.add(comment); } } | DaoFeature extends DaoKudosable implements DaoCommentable { @Override public void addComment(final DaoComment comment) { this.comments.add(comment); } private DaoFeature(final DaoMember member, final DaoTeam team, final DaoDescription description, final DaoSoftware software); protected DaoFeature(); } | DaoFeature extends DaoKudosable implements DaoCommentable { @Override public void addComment(final DaoComment comment) { this.comments.add(comment); } private DaoFeature(final DaoMember member, final DaoTeam team, final DaoDescription description, final DaoSoftware software); protected DaoFeature(); static DaoFeature... | DaoFeature extends DaoKudosable implements DaoCommentable { @Override public void addComment(final DaoComment comment) { this.comments.add(comment); } private DaoFeature(final DaoMember member, final DaoTeam team, final DaoDescription description, final DaoSoftware software); protected DaoFeature(); static DaoFeature... |
@Test public void testMinimal() { List<Element> list = jsonToElementParser.createWebItems(new ByteArrayInputStream("\n[{\"section\":\"foo\",\"weight\":40}\n]".getBytes())); assertNotNull(list); assertEquals(1, list.size()); assertEquals("foo", list.get(0).attributeValue("section")); } | public List<Element> createWebItems(InputStream in) { List<Element> items = newArrayList(); DocumentFactory factory = DocumentFactory.getInstance(); try { if (in == null) { return emptyList(); } final String content = StringUtils.join(IOUtils.readLines(in), "\n"); JSONArray root = new JSONArray(stripComments(content));... | JsonToElementParser { public List<Element> createWebItems(InputStream in) { List<Element> items = newArrayList(); DocumentFactory factory = DocumentFactory.getInstance(); try { if (in == null) { return emptyList(); } final String content = StringUtils.join(IOUtils.readLines(in), "\n"); JSONArray root = new JSONArray(st... | JsonToElementParser { public List<Element> createWebItems(InputStream in) { List<Element> items = newArrayList(); DocumentFactory factory = DocumentFactory.getInstance(); try { if (in == null) { return emptyList(); } final String content = StringUtils.join(IOUtils.readLines(in), "\n"); JSONArray root = new JSONArray(st... | JsonToElementParser { public List<Element> createWebItems(InputStream in) { List<Element> items = newArrayList(); DocumentFactory factory = DocumentFactory.getInstance(); try { if (in == null) { return emptyList(); } final String content = StringUtils.join(IOUtils.readLines(in), "\n"); JSONArray root = new JSONArray(st... | JsonToElementParser { public List<Element> createWebItems(InputStream in) { List<Element> items = newArrayList(); DocumentFactory factory = DocumentFactory.getInstance(); try { if (in == null) { return emptyList(); } final String content = StringUtils.join(IOUtils.readLines(in), "\n"); JSONArray root = new JSONArray(st... |
@Test public void testExtractAttributesMultiline() { JsDoc doc = JsDocParser.parse("foo", ""); assertEquals("bar jim", doc.getAttribute("foo")); } | public static JsDoc parse(String moduleId, String content) { if (content == null) { return EMPTY_JSDOC; } if (content.startsWith("/**")) { final String noStars = stripStars(content); Iterable<String> tokens = filter(asList(noStars.split("(?:^|[\\r\\n])\\s*@")), new Predicate<String>() { public boolean apply(String inpu... | JsDocParser { public static JsDoc parse(String moduleId, String content) { if (content == null) { return EMPTY_JSDOC; } if (content.startsWith("/**")) { final String noStars = stripStars(content); Iterable<String> tokens = filter(asList(noStars.split("(?:^|[\\r\\n])\\s*@")), new Predicate<String>() { public boolean app... | JsDocParser { public static JsDoc parse(String moduleId, String content) { if (content == null) { return EMPTY_JSDOC; } if (content.startsWith("/**")) { final String noStars = stripStars(content); Iterable<String> tokens = filter(asList(noStars.split("(?:^|[\\r\\n])\\s*@")), new Predicate<String>() { public boolean app... | JsDocParser { public static JsDoc parse(String moduleId, String content) { if (content == null) { return EMPTY_JSDOC; } if (content.startsWith("/**")) { final String noStars = stripStars(content); Iterable<String> tokens = filter(asList(noStars.split("(?:^|[\\r\\n])\\s*@")), new Predicate<String>() { public boolean app... | JsDocParser { public static JsDoc parse(String moduleId, String content) { if (content == null) { return EMPTY_JSDOC; } if (content.startsWith("/**")) { final String noStars = stripStars(content); Iterable<String> tokens = filter(asList(noStars.split("(?:^|[\\r\\n])\\s*@")), new Predicate<String>() { public boolean app... |
@Test public void testMinimalNoComment() { List<Element> list = jsonToElementParser.createWebItems(new ByteArrayInputStream("[{\"section\":\"foo\",\"weight\":40}\n]".getBytes())); assertNotNull(list); assertEquals(1, list.size()); assertEquals("foo", list.get(0).attributeValue("section")); } | public List<Element> createWebItems(InputStream in) { List<Element> items = newArrayList(); DocumentFactory factory = DocumentFactory.getInstance(); try { if (in == null) { return emptyList(); } final String content = StringUtils.join(IOUtils.readLines(in), "\n"); JSONArray root = new JSONArray(stripComments(content));... | JsonToElementParser { public List<Element> createWebItems(InputStream in) { List<Element> items = newArrayList(); DocumentFactory factory = DocumentFactory.getInstance(); try { if (in == null) { return emptyList(); } final String content = StringUtils.join(IOUtils.readLines(in), "\n"); JSONArray root = new JSONArray(st... | JsonToElementParser { public List<Element> createWebItems(InputStream in) { List<Element> items = newArrayList(); DocumentFactory factory = DocumentFactory.getInstance(); try { if (in == null) { return emptyList(); } final String content = StringUtils.join(IOUtils.readLines(in), "\n"); JSONArray root = new JSONArray(st... | JsonToElementParser { public List<Element> createWebItems(InputStream in) { List<Element> items = newArrayList(); DocumentFactory factory = DocumentFactory.getInstance(); try { if (in == null) { return emptyList(); } final String content = StringUtils.join(IOUtils.readLines(in), "\n"); JSONArray root = new JSONArray(st... | JsonToElementParser { public List<Element> createWebItems(InputStream in) { List<Element> items = newArrayList(); DocumentFactory factory = DocumentFactory.getInstance(); try { if (in == null) { return emptyList(); } final String content = StringUtils.join(IOUtils.readLines(in), "\n"); JSONArray root = new JSONArray(st... |
@Test public void testKeyFromFilename() { assertEquals("foo", KeyExtractor.extractFromFilename("foo")); assertEquals("foo", KeyExtractor.extractFromFilename("foo.zip")); assertEquals("foo", KeyExtractor.extractFromFilename("foo.jar")); assertEquals("foo", KeyExtractor.extractFromFilename("foo-1.zip")); assertEquals("fo... | public static String extractFromFilename(String fileName) { String name = stripExtension(fileName); Matcher m = TEMP_FILENAME_WITH_VERSION.matcher(name); if (m.matches()) { return m.group(1); } else { m = UPLOADED_FILENAME_WITH_VERSION.matcher(name); if (m.matches()) { return m.group(1); } } return name; } | KeyExtractor { public static String extractFromFilename(String fileName) { String name = stripExtension(fileName); Matcher m = TEMP_FILENAME_WITH_VERSION.matcher(name); if (m.matches()) { return m.group(1); } else { m = UPLOADED_FILENAME_WITH_VERSION.matcher(name); if (m.matches()) { return m.group(1); } } return name;... | KeyExtractor { public static String extractFromFilename(String fileName) { String name = stripExtension(fileName); Matcher m = TEMP_FILENAME_WITH_VERSION.matcher(name); if (m.matches()) { return m.group(1); } else { m = UPLOADED_FILENAME_WITH_VERSION.matcher(name); if (m.matches()) { return m.group(1); } } return name;... | KeyExtractor { public static String extractFromFilename(String fileName) { String name = stripExtension(fileName); Matcher m = TEMP_FILENAME_WITH_VERSION.matcher(name); if (m.matches()) { return m.group(1); } else { m = UPLOADED_FILENAME_WITH_VERSION.matcher(name); if (m.matches()) { return m.group(1); } } return name;... | KeyExtractor { public static String extractFromFilename(String fileName) { String name = stripExtension(fileName); Matcher m = TEMP_FILENAME_WITH_VERSION.matcher(name); if (m.matches()) { return m.group(1); } else { m = UPLOADED_FILENAME_WITH_VERSION.matcher(name); if (m.matches()) { return m.group(1); } } return name;... |
@Test public void testKeyFromTempFilename() { assertEquals("foo", KeyExtractor.extractFromFilename("foo----speakeasy-bar")); assertEquals("foo", KeyExtractor.extractFromFilename("foo----speakeasy-bar.zip")); assertEquals("foo-1", KeyExtractor.extractFromFilename("foo-1----speakeasy-jim.jar")); } | public static String extractFromFilename(String fileName) { String name = stripExtension(fileName); Matcher m = TEMP_FILENAME_WITH_VERSION.matcher(name); if (m.matches()) { return m.group(1); } else { m = UPLOADED_FILENAME_WITH_VERSION.matcher(name); if (m.matches()) { return m.group(1); } } return name; } | KeyExtractor { public static String extractFromFilename(String fileName) { String name = stripExtension(fileName); Matcher m = TEMP_FILENAME_WITH_VERSION.matcher(name); if (m.matches()) { return m.group(1); } else { m = UPLOADED_FILENAME_WITH_VERSION.matcher(name); if (m.matches()) { return m.group(1); } } return name;... | KeyExtractor { public static String extractFromFilename(String fileName) { String name = stripExtension(fileName); Matcher m = TEMP_FILENAME_WITH_VERSION.matcher(name); if (m.matches()) { return m.group(1); } else { m = UPLOADED_FILENAME_WITH_VERSION.matcher(name); if (m.matches()) { return m.group(1); } } return name;... | KeyExtractor { public static String extractFromFilename(String fileName) { String name = stripExtension(fileName); Matcher m = TEMP_FILENAME_WITH_VERSION.matcher(name); if (m.matches()) { return m.group(1); } else { m = UPLOADED_FILENAME_WITH_VERSION.matcher(name); if (m.matches()) { return m.group(1); } } return name;... | KeyExtractor { public static String extractFromFilename(String fileName) { String name = stripExtension(fileName); Matcher m = TEMP_FILENAME_WITH_VERSION.matcher(name); if (m.matches()) { return m.group(1); } else { m = UPLOADED_FILENAME_WITH_VERSION.matcher(name); if (m.matches()) { return m.group(1); } } return name;... |
@Test public void testGetEntries() throws IOException { final File dir = tmp.newFolder("names"); new File(dir, "foo.txt").createNewFile(); new File(dir, "a/b").mkdirs(); new File(dir, "a/bar.txt").createNewFile(); new File(dir, "c").mkdirs(); assertEquals(newArrayList("a/", "a/b/", "a/bar.txt", "c/", "foo.txt"), Reposi... | public static List<String> getEntries(File root) { return walk(root.toURI(), root); } | RepositoryDirectoryUtil { public static List<String> getEntries(File root) { return walk(root.toURI(), root); } } | RepositoryDirectoryUtil { public static List<String> getEntries(File root) { return walk(root.toURI(), root); } } | RepositoryDirectoryUtil { public static List<String> getEntries(File root) { return walk(root.toURI(), root); } static List<String> getEntries(File root); static List<String> walk(URI root, File dir); } | RepositoryDirectoryUtil { public static List<String> getEntries(File root) { return walk(root.toURI(), root); } static List<String> getEntries(File root); static List<String> walk(URI root, File dir); } |
@Test public void testStripStarsJsDocMultilineComment() { assertEquals("foo", JsDocParser.stripStars("")); } | static String stripStars(String jsDoc) { String noStartOrEndStars = jsDoc != null ? jsDoc.replaceAll("^\\/\\*\\*|\\*\\/$", "") : ""; String result = Pattern.compile("^\\s*\\* ?", Pattern.MULTILINE).matcher(noStartOrEndStars).replaceAll(""); return result.trim(); } | JsDocParser { static String stripStars(String jsDoc) { String noStartOrEndStars = jsDoc != null ? jsDoc.replaceAll("^\\/\\*\\*|\\*\\/$", "") : ""; String result = Pattern.compile("^\\s*\\* ?", Pattern.MULTILINE).matcher(noStartOrEndStars).replaceAll(""); return result.trim(); } } | JsDocParser { static String stripStars(String jsDoc) { String noStartOrEndStars = jsDoc != null ? jsDoc.replaceAll("^\\/\\*\\*|\\*\\/$", "") : ""; String result = Pattern.compile("^\\s*\\* ?", Pattern.MULTILINE).matcher(noStartOrEndStars).replaceAll(""); return result.trim(); } } | JsDocParser { static String stripStars(String jsDoc) { String noStartOrEndStars = jsDoc != null ? jsDoc.replaceAll("^\\/\\*\\*|\\*\\/$", "") : ""; String result = Pattern.compile("^\\s*\\* ?", Pattern.MULTILINE).matcher(noStartOrEndStars).replaceAll(""); return result.trim(); } static JsDoc parse(String moduleId, Stri... | JsDocParser { static String stripStars(String jsDoc) { String noStartOrEndStars = jsDoc != null ? jsDoc.replaceAll("^\\/\\*\\*|\\*\\/$", "") : ""; String result = Pattern.compile("^\\s*\\* ?", Pattern.MULTILINE).matcher(noStartOrEndStars).replaceAll(""); return result.trim(); } static JsDoc parse(String moduleId, Stri... |
@Test public void testStripStarsJsDocMultilineCommentWithStars() { assertEquals("foo", JsDocParser.stripStars("")); } | static String stripStars(String jsDoc) { String noStartOrEndStars = jsDoc != null ? jsDoc.replaceAll("^\\/\\*\\*|\\*\\/$", "") : ""; String result = Pattern.compile("^\\s*\\* ?", Pattern.MULTILINE).matcher(noStartOrEndStars).replaceAll(""); return result.trim(); } | JsDocParser { static String stripStars(String jsDoc) { String noStartOrEndStars = jsDoc != null ? jsDoc.replaceAll("^\\/\\*\\*|\\*\\/$", "") : ""; String result = Pattern.compile("^\\s*\\* ?", Pattern.MULTILINE).matcher(noStartOrEndStars).replaceAll(""); return result.trim(); } } | JsDocParser { static String stripStars(String jsDoc) { String noStartOrEndStars = jsDoc != null ? jsDoc.replaceAll("^\\/\\*\\*|\\*\\/$", "") : ""; String result = Pattern.compile("^\\s*\\* ?", Pattern.MULTILINE).matcher(noStartOrEndStars).replaceAll(""); return result.trim(); } } | JsDocParser { static String stripStars(String jsDoc) { String noStartOrEndStars = jsDoc != null ? jsDoc.replaceAll("^\\/\\*\\*|\\*\\/$", "") : ""; String result = Pattern.compile("^\\s*\\* ?", Pattern.MULTILINE).matcher(noStartOrEndStars).replaceAll(""); return result.trim(); } static JsDoc parse(String moduleId, Stri... | JsDocParser { static String stripStars(String jsDoc) { String noStartOrEndStars = jsDoc != null ? jsDoc.replaceAll("^\\/\\*\\*|\\*\\/$", "") : ""; String result = Pattern.compile("^\\s*\\* ?", Pattern.MULTILINE).matcher(noStartOrEndStars).replaceAll(""); return result.trim(); } static JsDoc parse(String moduleId, Stri... |
@Test public void testStripStarsJsDocMultilineCommentWithSpaceStars() { assertEquals("foo", JsDocParser.stripStars("")); } | static String stripStars(String jsDoc) { String noStartOrEndStars = jsDoc != null ? jsDoc.replaceAll("^\\/\\*\\*|\\*\\/$", "") : ""; String result = Pattern.compile("^\\s*\\* ?", Pattern.MULTILINE).matcher(noStartOrEndStars).replaceAll(""); return result.trim(); } | JsDocParser { static String stripStars(String jsDoc) { String noStartOrEndStars = jsDoc != null ? jsDoc.replaceAll("^\\/\\*\\*|\\*\\/$", "") : ""; String result = Pattern.compile("^\\s*\\* ?", Pattern.MULTILINE).matcher(noStartOrEndStars).replaceAll(""); return result.trim(); } } | JsDocParser { static String stripStars(String jsDoc) { String noStartOrEndStars = jsDoc != null ? jsDoc.replaceAll("^\\/\\*\\*|\\*\\/$", "") : ""; String result = Pattern.compile("^\\s*\\* ?", Pattern.MULTILINE).matcher(noStartOrEndStars).replaceAll(""); return result.trim(); } } | JsDocParser { static String stripStars(String jsDoc) { String noStartOrEndStars = jsDoc != null ? jsDoc.replaceAll("^\\/\\*\\*|\\*\\/$", "") : ""; String result = Pattern.compile("^\\s*\\* ?", Pattern.MULTILINE).matcher(noStartOrEndStars).replaceAll(""); return result.trim(); } static JsDoc parse(String moduleId, Stri... | JsDocParser { static String stripStars(String jsDoc) { String noStartOrEndStars = jsDoc != null ? jsDoc.replaceAll("^\\/\\*\\*|\\*\\/$", "") : ""; String result = Pattern.compile("^\\s*\\* ?", Pattern.MULTILINE).matcher(noStartOrEndStars).replaceAll(""); return result.trim(); } static JsDoc parse(String moduleId, Stri... |
@Test public void testStripStarsJsDocOneLineComment() { assertEquals("foo", JsDocParser.stripStars("")); } | static String stripStars(String jsDoc) { String noStartOrEndStars = jsDoc != null ? jsDoc.replaceAll("^\\/\\*\\*|\\*\\/$", "") : ""; String result = Pattern.compile("^\\s*\\* ?", Pattern.MULTILINE).matcher(noStartOrEndStars).replaceAll(""); return result.trim(); } | JsDocParser { static String stripStars(String jsDoc) { String noStartOrEndStars = jsDoc != null ? jsDoc.replaceAll("^\\/\\*\\*|\\*\\/$", "") : ""; String result = Pattern.compile("^\\s*\\* ?", Pattern.MULTILINE).matcher(noStartOrEndStars).replaceAll(""); return result.trim(); } } | JsDocParser { static String stripStars(String jsDoc) { String noStartOrEndStars = jsDoc != null ? jsDoc.replaceAll("^\\/\\*\\*|\\*\\/$", "") : ""; String result = Pattern.compile("^\\s*\\* ?", Pattern.MULTILINE).matcher(noStartOrEndStars).replaceAll(""); return result.trim(); } } | JsDocParser { static String stripStars(String jsDoc) { String noStartOrEndStars = jsDoc != null ? jsDoc.replaceAll("^\\/\\*\\*|\\*\\/$", "") : ""; String result = Pattern.compile("^\\s*\\* ?", Pattern.MULTILINE).matcher(noStartOrEndStars).replaceAll(""); return result.trim(); } static JsDoc parse(String moduleId, Stri... | JsDocParser { static String stripStars(String jsDoc) { String noStartOrEndStars = jsDoc != null ? jsDoc.replaceAll("^\\/\\*\\*|\\*\\/$", "") : ""; String result = Pattern.compile("^\\s*\\* ?", Pattern.MULTILINE).matcher(noStartOrEndStars).replaceAll(""); return result.trim(); } static JsDoc parse(String moduleId, Stri... |
@Test public void testExtractAttributes() { JsDoc doc = JsDocParser.parse("foo", ""); assertEquals("Desc", doc.getDescription()); assertEquals("bar", doc.getAttribute("foo")); assertEquals("jim bob", doc.getAttribute("baz")); } | static Map<String,String> extractAttributes(String jsDocWithNoStars) { return null; } | JsDocParser { static Map<String,String> extractAttributes(String jsDocWithNoStars) { return null; } } | JsDocParser { static Map<String,String> extractAttributes(String jsDocWithNoStars) { return null; } } | JsDocParser { static Map<String,String> extractAttributes(String jsDocWithNoStars) { return null; } static JsDoc parse(String moduleId, String content); } | JsDocParser { static Map<String,String> extractAttributes(String jsDocWithNoStars) { return null; } static JsDoc parse(String moduleId, String content); static final JsDoc EMPTY_JSDOC; } |
@Test public void test() { Optional<SentinelVersion> version = VersionUtils.parseVersion("1.2.3"); assertTrue(version.isPresent()); assertEquals(1, version.get().getMajorVersion()); assertEquals(2, version.get().getMinorVersion()); assertEquals(3, version.get().getFixVersion()); assertNull(version.get().getPostfix()); ... | public static Optional<SentinelVersion> parseVersion(String s) { if (StringUtil.isBlank(s)) { return Optional.empty(); } try { String versionFull = s; SentinelVersion version = new SentinelVersion(); int index = versionFull.indexOf("-"); if (index == 0) { return Optional.empty(); } if (index == versionFull.length() - 1... | VersionUtils { public static Optional<SentinelVersion> parseVersion(String s) { if (StringUtil.isBlank(s)) { return Optional.empty(); } try { String versionFull = s; SentinelVersion version = new SentinelVersion(); int index = versionFull.indexOf("-"); if (index == 0) { return Optional.empty(); } if (index == versionFu... | VersionUtils { public static Optional<SentinelVersion> parseVersion(String s) { if (StringUtil.isBlank(s)) { return Optional.empty(); } try { String versionFull = s; SentinelVersion version = new SentinelVersion(); int index = versionFull.indexOf("-"); if (index == 0) { return Optional.empty(); } if (index == versionFu... | VersionUtils { public static Optional<SentinelVersion> parseVersion(String s) { if (StringUtil.isBlank(s)) { return Optional.empty(); } try { String versionFull = s; SentinelVersion version = new SentinelVersion(); int index = versionFull.indexOf("-"); if (index == 0) { return Optional.empty(); } if (index == versionFu... | VersionUtils { public static Optional<SentinelVersion> parseVersion(String s) { if (StringUtil.isBlank(s)) { return Optional.empty(); } try { String versionFull = s; SentinelVersion version = new SentinelVersion(); int index = versionFull.indexOf("-"); if (index == 0) { return Optional.empty(); } if (index == versionFu... |
@Test public void testGetConfigInt() { DashboardConfig.clearCache(); assertEquals(0, DashboardConfig.getConfigInt("t", 0, 10)); DashboardConfig.clearCache(); assertEquals(1, DashboardConfig.getConfigInt("t", 1, 10)); System.setProperty("t", "asdf"); DashboardConfig.clearCache(); assertEquals(0, DashboardConfig.getConfi... | protected static int getConfigInt(String name, int defaultVal, int minVal) { if (cacheMap.containsKey(name)) { return (int)cacheMap.get(name); } int val = NumberUtils.toInt(getConfig(name)); if (val == 0) { val = defaultVal; } else if (val < minVal) { val = minVal; } cacheMap.put(name, val); return val; } | DashboardConfig { protected static int getConfigInt(String name, int defaultVal, int minVal) { if (cacheMap.containsKey(name)) { return (int)cacheMap.get(name); } int val = NumberUtils.toInt(getConfig(name)); if (val == 0) { val = defaultVal; } else if (val < minVal) { val = minVal; } cacheMap.put(name, val); return va... | DashboardConfig { protected static int getConfigInt(String name, int defaultVal, int minVal) { if (cacheMap.containsKey(name)) { return (int)cacheMap.get(name); } int val = NumberUtils.toInt(getConfig(name)); if (val == 0) { val = defaultVal; } else if (val < minVal) { val = minVal; } cacheMap.put(name, val); return va... | DashboardConfig { protected static int getConfigInt(String name, int defaultVal, int minVal) { if (cacheMap.containsKey(name)) { return (int)cacheMap.get(name); } int val = NumberUtils.toInt(getConfig(name)); if (val == 0) { val = defaultVal; } else if (val < minVal) { val = minVal; } cacheMap.put(name, val); return va... | DashboardConfig { protected static int getConfigInt(String name, int defaultVal, int minVal) { if (cacheMap.containsKey(name)) { return (int)cacheMap.get(name); } int val = NumberUtils.toInt(getConfig(name)); if (val == 0) { val = defaultVal; } else if (val < minVal) { val = minVal; } cacheMap.put(name, val); return va... |
@Test public void testSave() { MetricEntity entry = new MetricEntity(); entry.setApp("testSave"); entry.setResource("testResource"); entry.setTimestamp(new Date(System.currentTimeMillis())); entry.setPassQps(1L); entry.setExceptionQps(1L); entry.setBlockQps(0L); entry.setSuccessQps(1L); inMemoryMetricsRepository.save(e... | @Override public void save(MetricEntity entity) { if (entity == null || StringUtil.isBlank(entity.getApp())) { return; } readWriteLock.writeLock().lock(); try { allMetrics.computeIfAbsent(entity.getApp(), e -> new HashMap<>(16)) .computeIfAbsent(entity.getResource(), e -> new LinkedHashMap<Long, MetricEntity>() { @Over... | InMemoryMetricsRepository implements MetricsRepository<MetricEntity> { @Override public void save(MetricEntity entity) { if (entity == null || StringUtil.isBlank(entity.getApp())) { return; } readWriteLock.writeLock().lock(); try { allMetrics.computeIfAbsent(entity.getApp(), e -> new HashMap<>(16)) .computeIfAbsent(ent... | InMemoryMetricsRepository implements MetricsRepository<MetricEntity> { @Override public void save(MetricEntity entity) { if (entity == null || StringUtil.isBlank(entity.getApp())) { return; } readWriteLock.writeLock().lock(); try { allMetrics.computeIfAbsent(entity.getApp(), e -> new HashMap<>(16)) .computeIfAbsent(ent... | InMemoryMetricsRepository implements MetricsRepository<MetricEntity> { @Override public void save(MetricEntity entity) { if (entity == null || StringUtil.isBlank(entity.getApp())) { return; } readWriteLock.writeLock().lock(); try { allMetrics.computeIfAbsent(entity.getApp(), e -> new HashMap<>(16)) .computeIfAbsent(ent... | InMemoryMetricsRepository implements MetricsRepository<MetricEntity> { @Override public void save(MetricEntity entity) { if (entity == null || StringUtil.isBlank(entity.getApp())) { return; } readWriteLock.writeLock().lock(); try { allMetrics.computeIfAbsent(entity.getApp(), e -> new HashMap<>(16)) .computeIfAbsent(ent... |
@Test public void testSaveAll() { List<MetricEntity> entities = new ArrayList<>(10000); for (int i = 0; i < 10000; i++) { MetricEntity entry = new MetricEntity(); entry.setApp("testSaveAll"); entry.setResource("testResource" + i); entry.setTimestamp(new Date(System.currentTimeMillis())); entry.setPassQps(1L); entry.set... | @Override public void saveAll(Iterable<MetricEntity> metrics) { if (metrics == null) { return; } readWriteLock.writeLock().lock(); try { metrics.forEach(this::save); } finally { readWriteLock.writeLock().unlock(); } } | InMemoryMetricsRepository implements MetricsRepository<MetricEntity> { @Override public void saveAll(Iterable<MetricEntity> metrics) { if (metrics == null) { return; } readWriteLock.writeLock().lock(); try { metrics.forEach(this::save); } finally { readWriteLock.writeLock().unlock(); } } } | InMemoryMetricsRepository implements MetricsRepository<MetricEntity> { @Override public void saveAll(Iterable<MetricEntity> metrics) { if (metrics == null) { return; } readWriteLock.writeLock().lock(); try { metrics.forEach(this::save); } finally { readWriteLock.writeLock().unlock(); } } } | InMemoryMetricsRepository implements MetricsRepository<MetricEntity> { @Override public void saveAll(Iterable<MetricEntity> metrics) { if (metrics == null) { return; } readWriteLock.writeLock().lock(); try { metrics.forEach(this::save); } finally { readWriteLock.writeLock().unlock(); } } @Override void save(MetricEnti... | InMemoryMetricsRepository implements MetricsRepository<MetricEntity> { @Override public void saveAll(Iterable<MetricEntity> metrics) { if (metrics == null) { return; } readWriteLock.writeLock().lock(); try { metrics.forEach(this::save); } finally { readWriteLock.writeLock().unlock(); } } @Override void save(MetricEnti... |
@Test public void testConcurrentPutAndGet() { List<CompletableFuture> futures = new ArrayList<>(10000); final CyclicBarrier cyclicBarrier = new CyclicBarrier(8); for (int j = 0; j < 10000; j++) { final int finalJ = j; futures.add(CompletableFuture.runAsync(() -> { try { cyclicBarrier.await(); if (finalJ % 2 == 0) { bat... | @Override public List<String> listResourcesOfApp(String app) { List<String> results = new ArrayList<>(); if (StringUtil.isBlank(app)) { return results; } Map<String, LinkedHashMap<Long, MetricEntity>> resourceMap = allMetrics.get(app); if (resourceMap == null) { return results; } final long minTimeMs = System.currentTi... | InMemoryMetricsRepository implements MetricsRepository<MetricEntity> { @Override public List<String> listResourcesOfApp(String app) { List<String> results = new ArrayList<>(); if (StringUtil.isBlank(app)) { return results; } Map<String, LinkedHashMap<Long, MetricEntity>> resourceMap = allMetrics.get(app); if (resourceM... | InMemoryMetricsRepository implements MetricsRepository<MetricEntity> { @Override public List<String> listResourcesOfApp(String app) { List<String> results = new ArrayList<>(); if (StringUtil.isBlank(app)) { return results; } Map<String, LinkedHashMap<Long, MetricEntity>> resourceMap = allMetrics.get(app); if (resourceM... | InMemoryMetricsRepository implements MetricsRepository<MetricEntity> { @Override public List<String> listResourcesOfApp(String app) { List<String> results = new ArrayList<>(); if (StringUtil.isBlank(app)) { return results; } Map<String, LinkedHashMap<Long, MetricEntity>> resourceMap = allMetrics.get(app); if (resourceM... | InMemoryMetricsRepository implements MetricsRepository<MetricEntity> { @Override public List<String> listResourcesOfApp(String app) { List<String> results = new ArrayList<>(); if (StringUtil.isBlank(app)) { return results; } Map<String, LinkedHashMap<Long, MetricEntity>> resourceMap = allMetrics.get(app); if (resourceM... |
@Test public void postRequest() throws HttpException, IOException { RequestContent processor = new RequestContent(); Map<String, String> params = new HashMap<String, String>(); params.put("a", "1"); params.put("b", "2+"); params.put("c", "3 "); HttpUriRequest request; request = SentinelApiClient.postRequest("/test", pa... | protected static HttpUriRequest postRequest(String url, Map<String, String> params, boolean supportEnhancedContentType) { HttpPost httpPost = new HttpPost(url); if (params != null && params.size() > 0) { List<NameValuePair> list = new ArrayList<>(params.size()); for (Entry<String, String> entry : params.entrySet()) { l... | SentinelApiClient { protected static HttpUriRequest postRequest(String url, Map<String, String> params, boolean supportEnhancedContentType) { HttpPost httpPost = new HttpPost(url); if (params != null && params.size() > 0) { List<NameValuePair> list = new ArrayList<>(params.size()); for (Entry<String, String> entry : pa... | SentinelApiClient { protected static HttpUriRequest postRequest(String url, Map<String, String> params, boolean supportEnhancedContentType) { HttpPost httpPost = new HttpPost(url); if (params != null && params.size() > 0) { List<NameValuePair> list = new ArrayList<>(params.size()); for (Entry<String, String> entry : pa... | SentinelApiClient { protected static HttpUriRequest postRequest(String url, Map<String, String> params, boolean supportEnhancedContentType) { HttpPost httpPost = new HttpPost(url); if (params != null && params.size() > 0) { List<NameValuePair> list = new ArrayList<>(params.size()); for (Entry<String, String> entry : pa... | SentinelApiClient { protected static HttpUriRequest postRequest(String url, Map<String, String> params, boolean supportEnhancedContentType) { HttpPost httpPost = new HttpPost(url); if (params != null && params.size() > 0) { List<NameValuePair> list = new ArrayList<>(params.size()); for (Entry<String, String> entry : pa... |
@Test public void testGreater() { assertTrue(new SentinelVersion(2, 0, 0).greaterThan(new SentinelVersion(1, 0, 0))); assertTrue(new SentinelVersion(1, 1, 0).greaterThan(new SentinelVersion(1, 0, 0))); assertTrue(new SentinelVersion(1, 1, 2).greaterThan(new SentinelVersion(1, 1, 0))); assertTrue(new SentinelVersion(1, ... | public boolean greaterThan(SentinelVersion version) { if (version == null) { return true; } return getFullVersion() > version.getFullVersion(); } | SentinelVersion { public boolean greaterThan(SentinelVersion version) { if (version == null) { return true; } return getFullVersion() > version.getFullVersion(); } } | SentinelVersion { public boolean greaterThan(SentinelVersion version) { if (version == null) { return true; } return getFullVersion() > version.getFullVersion(); } SentinelVersion(); SentinelVersion(int major, int minor, int fix); SentinelVersion(int major, int minor, int fix, String postfix); } | SentinelVersion { public boolean greaterThan(SentinelVersion version) { if (version == null) { return true; } return getFullVersion() > version.getFullVersion(); } SentinelVersion(); SentinelVersion(int major, int minor, int fix); SentinelVersion(int major, int minor, int fix, String postfix); int getFullVersion(); i... | SentinelVersion { public boolean greaterThan(SentinelVersion version) { if (version == null) { return true; } return getFullVersion() > version.getFullVersion(); } SentinelVersion(); SentinelVersion(int major, int minor, int fix); SentinelVersion(int major, int minor, int fix, String postfix); int getFullVersion(); i... |
@Test public void testGetApplicationContext() { ApplicationContext context = SpringContextHolder.getApplicationContext(); PersonMapper personMapper = SpringContextHolder.getBean(PersonMapper.class); personMapper.findAll(); personMapper.findAll(); logger.info(personMapper.getClass().getName()); } | public static ApplicationContext getApplicationContext() { checkApplicationContext(); return context; } | SpringContextHolder implements ApplicationContextAware { public static ApplicationContext getApplicationContext() { checkApplicationContext(); return context; } } | SpringContextHolder implements ApplicationContextAware { public static ApplicationContext getApplicationContext() { checkApplicationContext(); return context; } } | SpringContextHolder implements ApplicationContextAware { public static ApplicationContext getApplicationContext() { checkApplicationContext(); return context; } @Override void setApplicationContext(ApplicationContext applicationContext); static ApplicationContext getApplicationContext(); static T getBean(String name);... | SpringContextHolder implements ApplicationContextAware { public static ApplicationContext getApplicationContext() { checkApplicationContext(); return context; } @Override void setApplicationContext(ApplicationContext applicationContext); static ApplicationContext getApplicationContext(); static T getBean(String name);... |
@Test public void testQueryApis() throws Exception { String path = "/gateway/api/list.json"; List<ApiDefinitionEntity> entities = new ArrayList<>(); ApiDefinitionEntity entity = new ApiDefinitionEntity(); entity.setId(1L); entity.setApp(TEST_APP); entity.setIp(TEST_IP); entity.setPort(TEST_PORT); entity.setApiName("foo... | @GetMapping("/list.json") @AuthAction(AuthService.PrivilegeType.READ_RULE) public Result<List<ApiDefinitionEntity>> queryApis(String app, String ip, Integer port) { if (StringUtil.isEmpty(app)) { return Result.ofFail(-1, "app can't be null or empty"); } if (StringUtil.isEmpty(ip)) { return Result.ofFail(-1, "ip can't b... | GatewayApiController { @GetMapping("/list.json") @AuthAction(AuthService.PrivilegeType.READ_RULE) public Result<List<ApiDefinitionEntity>> queryApis(String app, String ip, Integer port) { if (StringUtil.isEmpty(app)) { return Result.ofFail(-1, "app can't be null or empty"); } if (StringUtil.isEmpty(ip)) { return Result... | GatewayApiController { @GetMapping("/list.json") @AuthAction(AuthService.PrivilegeType.READ_RULE) public Result<List<ApiDefinitionEntity>> queryApis(String app, String ip, Integer port) { if (StringUtil.isEmpty(app)) { return Result.ofFail(-1, "app can't be null or empty"); } if (StringUtil.isEmpty(ip)) { return Result... | GatewayApiController { @GetMapping("/list.json") @AuthAction(AuthService.PrivilegeType.READ_RULE) public Result<List<ApiDefinitionEntity>> queryApis(String app, String ip, Integer port) { if (StringUtil.isEmpty(app)) { return Result.ofFail(-1, "app can't be null or empty"); } if (StringUtil.isEmpty(ip)) { return Result... | GatewayApiController { @GetMapping("/list.json") @AuthAction(AuthService.PrivilegeType.READ_RULE) public Result<List<ApiDefinitionEntity>> queryApis(String app, String ip, Integer port) { if (StringUtil.isEmpty(app)) { return Result.ofFail(-1, "app can't be null or empty"); } if (StringUtil.isEmpty(ip)) { return Result... |
@Test public void testAddApi() throws Exception { String path = "/gateway/api/new.json"; AddApiReqVo reqVo = new AddApiReqVo(); reqVo.setApp(TEST_APP); reqVo.setIp(TEST_IP); reqVo.setPort(TEST_PORT); reqVo.setApiName("customized_api"); List<ApiPredicateItemVo> itemVos = new ArrayList<>(); ApiPredicateItemVo itemVo = ne... | @PostMapping("/new.json") @AuthAction(AuthService.PrivilegeType.WRITE_RULE) public Result<ApiDefinitionEntity> addApi(HttpServletRequest request, @RequestBody AddApiReqVo reqVo) { String app = reqVo.getApp(); if (StringUtil.isBlank(app)) { return Result.ofFail(-1, "app can't be null or empty"); } ApiDefinitionEntity en... | GatewayApiController { @PostMapping("/new.json") @AuthAction(AuthService.PrivilegeType.WRITE_RULE) public Result<ApiDefinitionEntity> addApi(HttpServletRequest request, @RequestBody AddApiReqVo reqVo) { String app = reqVo.getApp(); if (StringUtil.isBlank(app)) { return Result.ofFail(-1, "app can't be null or empty"); }... | GatewayApiController { @PostMapping("/new.json") @AuthAction(AuthService.PrivilegeType.WRITE_RULE) public Result<ApiDefinitionEntity> addApi(HttpServletRequest request, @RequestBody AddApiReqVo reqVo) { String app = reqVo.getApp(); if (StringUtil.isBlank(app)) { return Result.ofFail(-1, "app can't be null or empty"); }... | GatewayApiController { @PostMapping("/new.json") @AuthAction(AuthService.PrivilegeType.WRITE_RULE) public Result<ApiDefinitionEntity> addApi(HttpServletRequest request, @RequestBody AddApiReqVo reqVo) { String app = reqVo.getApp(); if (StringUtil.isBlank(app)) { return Result.ofFail(-1, "app can't be null or empty"); }... | GatewayApiController { @PostMapping("/new.json") @AuthAction(AuthService.PrivilegeType.WRITE_RULE) public Result<ApiDefinitionEntity> addApi(HttpServletRequest request, @RequestBody AddApiReqVo reqVo) { String app = reqVo.getApp(); if (StringUtil.isBlank(app)) { return Result.ofFail(-1, "app can't be null or empty"); }... |
@Test public void testUpdateApi() throws Exception { String path = "/gateway/api/save.json"; ApiDefinitionEntity addEntity = new ApiDefinitionEntity(); addEntity.setApp(TEST_APP); addEntity.setIp(TEST_IP); addEntity.setPort(TEST_PORT); addEntity.setApiName("bbb"); Date date = new Date(); date = DateUtils.addSeconds(dat... | @PostMapping("/save.json") @AuthAction(AuthService.PrivilegeType.WRITE_RULE) public Result<ApiDefinitionEntity> updateApi(@RequestBody UpdateApiReqVo reqVo) { String app = reqVo.getApp(); if (StringUtil.isBlank(app)) { return Result.ofFail(-1, "app can't be null or empty"); } Long id = reqVo.getId(); if (id == null) { ... | GatewayApiController { @PostMapping("/save.json") @AuthAction(AuthService.PrivilegeType.WRITE_RULE) public Result<ApiDefinitionEntity> updateApi(@RequestBody UpdateApiReqVo reqVo) { String app = reqVo.getApp(); if (StringUtil.isBlank(app)) { return Result.ofFail(-1, "app can't be null or empty"); } Long id = reqVo.getI... | GatewayApiController { @PostMapping("/save.json") @AuthAction(AuthService.PrivilegeType.WRITE_RULE) public Result<ApiDefinitionEntity> updateApi(@RequestBody UpdateApiReqVo reqVo) { String app = reqVo.getApp(); if (StringUtil.isBlank(app)) { return Result.ofFail(-1, "app can't be null or empty"); } Long id = reqVo.getI... | GatewayApiController { @PostMapping("/save.json") @AuthAction(AuthService.PrivilegeType.WRITE_RULE) public Result<ApiDefinitionEntity> updateApi(@RequestBody UpdateApiReqVo reqVo) { String app = reqVo.getApp(); if (StringUtil.isBlank(app)) { return Result.ofFail(-1, "app can't be null or empty"); } Long id = reqVo.getI... | GatewayApiController { @PostMapping("/save.json") @AuthAction(AuthService.PrivilegeType.WRITE_RULE) public Result<ApiDefinitionEntity> updateApi(@RequestBody UpdateApiReqVo reqVo) { String app = reqVo.getApp(); if (StringUtil.isBlank(app)) { return Result.ofFail(-1, "app can't be null or empty"); } Long id = reqVo.getI... |
@Test public void testDeleteApi() throws Exception { String path = "/gateway/api/delete.json"; ApiDefinitionEntity addEntity = new ApiDefinitionEntity(); addEntity.setApp(TEST_APP); addEntity.setIp(TEST_IP); addEntity.setPort(TEST_PORT); addEntity.setApiName("ccc"); Date date = new Date(); addEntity.setGmtCreate(date);... | @PostMapping("/delete.json") @AuthAction(AuthService.PrivilegeType.DELETE_RULE) public Result<Long> deleteApi(Long id) { if (id == null) { return Result.ofFail(-1, "id can't be null"); } ApiDefinitionEntity oldEntity = repository.findById(id); if (oldEntity == null) { return Result.ofSuccess(null); } try { repository.d... | GatewayApiController { @PostMapping("/delete.json") @AuthAction(AuthService.PrivilegeType.DELETE_RULE) public Result<Long> deleteApi(Long id) { if (id == null) { return Result.ofFail(-1, "id can't be null"); } ApiDefinitionEntity oldEntity = repository.findById(id); if (oldEntity == null) { return Result.ofSuccess(null... | GatewayApiController { @PostMapping("/delete.json") @AuthAction(AuthService.PrivilegeType.DELETE_RULE) public Result<Long> deleteApi(Long id) { if (id == null) { return Result.ofFail(-1, "id can't be null"); } ApiDefinitionEntity oldEntity = repository.findById(id); if (oldEntity == null) { return Result.ofSuccess(null... | GatewayApiController { @PostMapping("/delete.json") @AuthAction(AuthService.PrivilegeType.DELETE_RULE) public Result<Long> deleteApi(Long id) { if (id == null) { return Result.ofFail(-1, "id can't be null"); } ApiDefinitionEntity oldEntity = repository.findById(id); if (oldEntity == null) { return Result.ofSuccess(null... | GatewayApiController { @PostMapping("/delete.json") @AuthAction(AuthService.PrivilegeType.DELETE_RULE) public Result<Long> deleteApi(Long id) { if (id == null) { return Result.ofFail(-1, "id can't be null"); } ApiDefinitionEntity oldEntity = repository.findById(id); if (oldEntity == null) { return Result.ofSuccess(null... |
@Test public void testQueryFlowRules() throws Exception { String path = "/gateway/flow/list.json"; List<GatewayFlowRuleEntity> entities = new ArrayList<>(); GatewayFlowRuleEntity entity = new GatewayFlowRuleEntity(); entity.setId(1L); entity.setApp(TEST_APP); entity.setIp(TEST_IP); entity.setPort(TEST_PORT); entity.set... | @GetMapping("/list.json") @AuthAction(AuthService.PrivilegeType.READ_RULE) public Result<List<GatewayFlowRuleEntity>> queryFlowRules(String app, String ip, Integer port) { if (StringUtil.isEmpty(app)) { return Result.ofFail(-1, "app can't be null or empty"); } if (StringUtil.isEmpty(ip)) { return Result.ofFail(-1, "ip ... | GatewayFlowRuleController { @GetMapping("/list.json") @AuthAction(AuthService.PrivilegeType.READ_RULE) public Result<List<GatewayFlowRuleEntity>> queryFlowRules(String app, String ip, Integer port) { if (StringUtil.isEmpty(app)) { return Result.ofFail(-1, "app can't be null or empty"); } if (StringUtil.isEmpty(ip)) { r... | GatewayFlowRuleController { @GetMapping("/list.json") @AuthAction(AuthService.PrivilegeType.READ_RULE) public Result<List<GatewayFlowRuleEntity>> queryFlowRules(String app, String ip, Integer port) { if (StringUtil.isEmpty(app)) { return Result.ofFail(-1, "app can't be null or empty"); } if (StringUtil.isEmpty(ip)) { r... | GatewayFlowRuleController { @GetMapping("/list.json") @AuthAction(AuthService.PrivilegeType.READ_RULE) public Result<List<GatewayFlowRuleEntity>> queryFlowRules(String app, String ip, Integer port) { if (StringUtil.isEmpty(app)) { return Result.ofFail(-1, "app can't be null or empty"); } if (StringUtil.isEmpty(ip)) { r... | GatewayFlowRuleController { @GetMapping("/list.json") @AuthAction(AuthService.PrivilegeType.READ_RULE) public Result<List<GatewayFlowRuleEntity>> queryFlowRules(String app, String ip, Integer port) { if (StringUtil.isEmpty(app)) { return Result.ofFail(-1, "app can't be null or empty"); } if (StringUtil.isEmpty(ip)) { r... |
@Test public void testAddFlowRule() throws Exception { String path = "/gateway/flow/new.json"; AddFlowRuleReqVo reqVo = new AddFlowRuleReqVo(); reqVo.setApp(TEST_APP); reqVo.setIp(TEST_IP); reqVo.setPort(TEST_PORT); reqVo.setResourceMode(RESOURCE_MODE_ROUTE_ID); reqVo.setResource("httpbin_route"); reqVo.setGrade(FLOW_G... | @PostMapping("/new.json") @AuthAction(AuthService.PrivilegeType.WRITE_RULE) public Result<GatewayFlowRuleEntity> addFlowRule(@RequestBody AddFlowRuleReqVo reqVo) { String app = reqVo.getApp(); if (StringUtil.isBlank(app)) { return Result.ofFail(-1, "app can't be null or empty"); } GatewayFlowRuleEntity entity = new Gat... | GatewayFlowRuleController { @PostMapping("/new.json") @AuthAction(AuthService.PrivilegeType.WRITE_RULE) public Result<GatewayFlowRuleEntity> addFlowRule(@RequestBody AddFlowRuleReqVo reqVo) { String app = reqVo.getApp(); if (StringUtil.isBlank(app)) { return Result.ofFail(-1, "app can't be null or empty"); } GatewayFlo... | GatewayFlowRuleController { @PostMapping("/new.json") @AuthAction(AuthService.PrivilegeType.WRITE_RULE) public Result<GatewayFlowRuleEntity> addFlowRule(@RequestBody AddFlowRuleReqVo reqVo) { String app = reqVo.getApp(); if (StringUtil.isBlank(app)) { return Result.ofFail(-1, "app can't be null or empty"); } GatewayFlo... | GatewayFlowRuleController { @PostMapping("/new.json") @AuthAction(AuthService.PrivilegeType.WRITE_RULE) public Result<GatewayFlowRuleEntity> addFlowRule(@RequestBody AddFlowRuleReqVo reqVo) { String app = reqVo.getApp(); if (StringUtil.isBlank(app)) { return Result.ofFail(-1, "app can't be null or empty"); } GatewayFlo... | GatewayFlowRuleController { @PostMapping("/new.json") @AuthAction(AuthService.PrivilegeType.WRITE_RULE) public Result<GatewayFlowRuleEntity> addFlowRule(@RequestBody AddFlowRuleReqVo reqVo) { String app = reqVo.getApp(); if (StringUtil.isBlank(app)) { return Result.ofFail(-1, "app can't be null or empty"); } GatewayFlo... |
@Test public void testUpdateFlowRule() throws Exception { String path = "/gateway/flow/save.json"; GatewayFlowRuleEntity addEntity = new GatewayFlowRuleEntity(); addEntity.setId(1L); addEntity.setApp(TEST_APP); addEntity.setIp(TEST_IP); addEntity.setPort(TEST_PORT); addEntity.setResource("httpbin_route"); addEntity.set... | @PostMapping("/save.json") @AuthAction(AuthService.PrivilegeType.WRITE_RULE) public Result<GatewayFlowRuleEntity> updateFlowRule(@RequestBody UpdateFlowRuleReqVo reqVo) { String app = reqVo.getApp(); if (StringUtil.isBlank(app)) { return Result.ofFail(-1, "app can't be null or empty"); } Long id = reqVo.getId(); if (id... | GatewayFlowRuleController { @PostMapping("/save.json") @AuthAction(AuthService.PrivilegeType.WRITE_RULE) public Result<GatewayFlowRuleEntity> updateFlowRule(@RequestBody UpdateFlowRuleReqVo reqVo) { String app = reqVo.getApp(); if (StringUtil.isBlank(app)) { return Result.ofFail(-1, "app can't be null or empty"); } Lon... | GatewayFlowRuleController { @PostMapping("/save.json") @AuthAction(AuthService.PrivilegeType.WRITE_RULE) public Result<GatewayFlowRuleEntity> updateFlowRule(@RequestBody UpdateFlowRuleReqVo reqVo) { String app = reqVo.getApp(); if (StringUtil.isBlank(app)) { return Result.ofFail(-1, "app can't be null or empty"); } Lon... | GatewayFlowRuleController { @PostMapping("/save.json") @AuthAction(AuthService.PrivilegeType.WRITE_RULE) public Result<GatewayFlowRuleEntity> updateFlowRule(@RequestBody UpdateFlowRuleReqVo reqVo) { String app = reqVo.getApp(); if (StringUtil.isBlank(app)) { return Result.ofFail(-1, "app can't be null or empty"); } Lon... | GatewayFlowRuleController { @PostMapping("/save.json") @AuthAction(AuthService.PrivilegeType.WRITE_RULE) public Result<GatewayFlowRuleEntity> updateFlowRule(@RequestBody UpdateFlowRuleReqVo reqVo) { String app = reqVo.getApp(); if (StringUtil.isBlank(app)) { return Result.ofFail(-1, "app can't be null or empty"); } Lon... |
@Test public void testDeleteFlowRule() throws Exception { String path = "/gateway/flow/delete.json"; GatewayFlowRuleEntity addEntity = new GatewayFlowRuleEntity(); addEntity.setId(1L); addEntity.setApp(TEST_APP); addEntity.setIp(TEST_IP); addEntity.setPort(TEST_PORT); addEntity.setResource("httpbin_route"); addEntity.s... | @PostMapping("/delete.json") @AuthAction(AuthService.PrivilegeType.DELETE_RULE) public Result<Long> deleteFlowRule(Long id) { if (id == null) { return Result.ofFail(-1, "id can't be null"); } GatewayFlowRuleEntity oldEntity = repository.findById(id); if (oldEntity == null) { return Result.ofSuccess(null); } try { repos... | GatewayFlowRuleController { @PostMapping("/delete.json") @AuthAction(AuthService.PrivilegeType.DELETE_RULE) public Result<Long> deleteFlowRule(Long id) { if (id == null) { return Result.ofFail(-1, "id can't be null"); } GatewayFlowRuleEntity oldEntity = repository.findById(id); if (oldEntity == null) { return Result.of... | GatewayFlowRuleController { @PostMapping("/delete.json") @AuthAction(AuthService.PrivilegeType.DELETE_RULE) public Result<Long> deleteFlowRule(Long id) { if (id == null) { return Result.ofFail(-1, "id can't be null"); } GatewayFlowRuleEntity oldEntity = repository.findById(id); if (oldEntity == null) { return Result.of... | GatewayFlowRuleController { @PostMapping("/delete.json") @AuthAction(AuthService.PrivilegeType.DELETE_RULE) public Result<Long> deleteFlowRule(Long id) { if (id == null) { return Result.ofFail(-1, "id can't be null"); } GatewayFlowRuleEntity oldEntity = repository.findById(id); if (oldEntity == null) { return Result.of... | GatewayFlowRuleController { @PostMapping("/delete.json") @AuthAction(AuthService.PrivilegeType.DELETE_RULE) public Result<Long> deleteFlowRule(Long id) { if (id == null) { return Result.ofFail(-1, "id can't be null"); } GatewayFlowRuleEntity oldEntity = repository.findById(id); if (oldEntity == null) { return Result.of... |
@Test public void testGetConfigStr() { DashboardConfig.clearCache(); assertEquals(null, DashboardConfig.getConfigStr("a")); System.setProperty("a", "111"); assertEquals("111", DashboardConfig.getConfigStr("a")); environmentVariables.set("a", "222"); assertEquals("111", DashboardConfig.getConfigStr("a")); DashboardConfi... | protected static String getConfigStr(String name) { if (cacheMap.containsKey(name)) { return (String) cacheMap.get(name); } String val = getConfig(name); if (StringUtils.isBlank(val)) { return null; } cacheMap.put(name, val); return val; } | DashboardConfig { protected static String getConfigStr(String name) { if (cacheMap.containsKey(name)) { return (String) cacheMap.get(name); } String val = getConfig(name); if (StringUtils.isBlank(val)) { return null; } cacheMap.put(name, val); return val; } } | DashboardConfig { protected static String getConfigStr(String name) { if (cacheMap.containsKey(name)) { return (String) cacheMap.get(name); } String val = getConfig(name); if (StringUtils.isBlank(val)) { return null; } cacheMap.put(name, val); return val; } } | DashboardConfig { protected static String getConfigStr(String name) { if (cacheMap.containsKey(name)) { return (String) cacheMap.get(name); } String val = getConfig(name); if (StringUtils.isBlank(val)) { return null; } cacheMap.put(name, val); return val; } static String getAuthUsername(); static String getAuthPasswor... | DashboardConfig { protected static String getConfigStr(String name) { if (cacheMap.containsKey(name)) { return (String) cacheMap.get(name); } String val = getConfig(name); if (StringUtils.isBlank(val)) { return null; } cacheMap.put(name, val); return val; } static String getAuthUsername(); static String getAuthPasswor... |
@Test public void RGB_to_3ByteBGR() { new ImageConversion().RGB_to_3ByteBGR(); } | @Benchmark public BufferedImage RGB_to_3ByteBGR() { DataBuffer buffer = new DataBufferByte(RGB_SRC, RGB_SRC.length); SampleModel sampleModel = new ComponentSampleModel(DataBuffer.TYPE_BYTE, WIDTH, HEIGHT, 3, WIDTH * 3, new int[]{0, 1, 2}); BufferedImage image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_3BYTE_... | ImageConversion { @Benchmark public BufferedImage RGB_to_3ByteBGR() { DataBuffer buffer = new DataBufferByte(RGB_SRC, RGB_SRC.length); SampleModel sampleModel = new ComponentSampleModel(DataBuffer.TYPE_BYTE, WIDTH, HEIGHT, 3, WIDTH * 3, new int[]{0, 1, 2}); BufferedImage image = new BufferedImage(WIDTH, HEIGHT, Buffere... | ImageConversion { @Benchmark public BufferedImage RGB_to_3ByteBGR() { DataBuffer buffer = new DataBufferByte(RGB_SRC, RGB_SRC.length); SampleModel sampleModel = new ComponentSampleModel(DataBuffer.TYPE_BYTE, WIDTH, HEIGHT, 3, WIDTH * 3, new int[]{0, 1, 2}); BufferedImage image = new BufferedImage(WIDTH, HEIGHT, Buffere... | ImageConversion { @Benchmark public BufferedImage RGB_to_3ByteBGR() { DataBuffer buffer = new DataBufferByte(RGB_SRC, RGB_SRC.length); SampleModel sampleModel = new ComponentSampleModel(DataBuffer.TYPE_BYTE, WIDTH, HEIGHT, 3, WIDTH * 3, new int[]{0, 1, 2}); BufferedImage image = new BufferedImage(WIDTH, HEIGHT, Buffere... | ImageConversion { @Benchmark public BufferedImage RGB_to_3ByteBGR() { DataBuffer buffer = new DataBufferByte(RGB_SRC, RGB_SRC.length); SampleModel sampleModel = new ComponentSampleModel(DataBuffer.TYPE_BYTE, WIDTH, HEIGHT, 3, WIDTH * 3, new int[]{0, 1, 2}); BufferedImage image = new BufferedImage(WIDTH, HEIGHT, Buffere... |
@Test public void RGBA_to_4ByteABGR() { new ImageConversion().RGBA_to_4ByteABGR(); } | @Benchmark public BufferedImage RGBA_to_4ByteABGR() { DataBuffer buffer = new DataBufferByte(RGBA_SRC, RGBA_SRC.length); SampleModel sampleModel = new ComponentSampleModel(DataBuffer.TYPE_BYTE, WIDTH, HEIGHT, 4, WIDTH * 4, new int[]{0, 1, 2, 3}); BufferedImage image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE... | ImageConversion { @Benchmark public BufferedImage RGBA_to_4ByteABGR() { DataBuffer buffer = new DataBufferByte(RGBA_SRC, RGBA_SRC.length); SampleModel sampleModel = new ComponentSampleModel(DataBuffer.TYPE_BYTE, WIDTH, HEIGHT, 4, WIDTH * 4, new int[]{0, 1, 2, 3}); BufferedImage image = new BufferedImage(WIDTH, HEIGHT, ... | ImageConversion { @Benchmark public BufferedImage RGBA_to_4ByteABGR() { DataBuffer buffer = new DataBufferByte(RGBA_SRC, RGBA_SRC.length); SampleModel sampleModel = new ComponentSampleModel(DataBuffer.TYPE_BYTE, WIDTH, HEIGHT, 4, WIDTH * 4, new int[]{0, 1, 2, 3}); BufferedImage image = new BufferedImage(WIDTH, HEIGHT, ... | ImageConversion { @Benchmark public BufferedImage RGBA_to_4ByteABGR() { DataBuffer buffer = new DataBufferByte(RGBA_SRC, RGBA_SRC.length); SampleModel sampleModel = new ComponentSampleModel(DataBuffer.TYPE_BYTE, WIDTH, HEIGHT, 4, WIDTH * 4, new int[]{0, 1, 2, 3}); BufferedImage image = new BufferedImage(WIDTH, HEIGHT, ... | ImageConversion { @Benchmark public BufferedImage RGBA_to_4ByteABGR() { DataBuffer buffer = new DataBufferByte(RGBA_SRC, RGBA_SRC.length); SampleModel sampleModel = new ComponentSampleModel(DataBuffer.TYPE_BYTE, WIDTH, HEIGHT, 4, WIDTH * 4, new int[]{0, 1, 2, 3}); BufferedImage image = new BufferedImage(WIDTH, HEIGHT, ... |
@Test public void ABGR_to_4ByteABGR() { new ImageConversion().ABGR_to_4ByteABGR_arraycopy(); } | @Benchmark public BufferedImage ABGR_to_4ByteABGR_arraycopy() { BufferedImage image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_4BYTE_ABGR); DataBufferByte buffer = (DataBufferByte)(image.getRaster().getDataBuffer()); byte[] data = buffer.getData(); System.arraycopy(ABGR_SRC, 0, data, 0, ABGR_SRC.length); ret... | ImageConversion { @Benchmark public BufferedImage ABGR_to_4ByteABGR_arraycopy() { BufferedImage image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_4BYTE_ABGR); DataBufferByte buffer = (DataBufferByte)(image.getRaster().getDataBuffer()); byte[] data = buffer.getData(); System.arraycopy(ABGR_SRC, 0, data, 0, ABG... | ImageConversion { @Benchmark public BufferedImage ABGR_to_4ByteABGR_arraycopy() { BufferedImage image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_4BYTE_ABGR); DataBufferByte buffer = (DataBufferByte)(image.getRaster().getDataBuffer()); byte[] data = buffer.getData(); System.arraycopy(ABGR_SRC, 0, data, 0, ABG... | ImageConversion { @Benchmark public BufferedImage ABGR_to_4ByteABGR_arraycopy() { BufferedImage image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_4BYTE_ABGR); DataBufferByte buffer = (DataBufferByte)(image.getRaster().getDataBuffer()); byte[] data = buffer.getData(); System.arraycopy(ABGR_SRC, 0, data, 0, ABG... | ImageConversion { @Benchmark public BufferedImage ABGR_to_4ByteABGR_arraycopy() { BufferedImage image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_4BYTE_ABGR); DataBufferByte buffer = (DataBufferByte)(image.getRaster().getDataBuffer()); byte[] data = buffer.getData(); System.arraycopy(ABGR_SRC, 0, data, 0, ABG... |
@Test public void ABGR_to_4ByteABGR_instantiate() { new ImageConversion().ABGR_to_4ByteABGR_instantiate(); } | @Benchmark public BufferedImage ABGR_to_4ByteABGR_instantiate() { ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB); ColorModel colorModel; WritableRaster raster; int[] nBits = {8, 8, 8, 8}; int[] bOffs = {3, 2, 1, 0}; colorModel = new ComponentColorModel(cs, nBits, true, false, Transparency.TRANSLUCENT, DataB... | ImageConversion { @Benchmark public BufferedImage ABGR_to_4ByteABGR_instantiate() { ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB); ColorModel colorModel; WritableRaster raster; int[] nBits = {8, 8, 8, 8}; int[] bOffs = {3, 2, 1, 0}; colorModel = new ComponentColorModel(cs, nBits, true, false, Transparency.... | ImageConversion { @Benchmark public BufferedImage ABGR_to_4ByteABGR_instantiate() { ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB); ColorModel colorModel; WritableRaster raster; int[] nBits = {8, 8, 8, 8}; int[] bOffs = {3, 2, 1, 0}; colorModel = new ComponentColorModel(cs, nBits, true, false, Transparency.... | ImageConversion { @Benchmark public BufferedImage ABGR_to_4ByteABGR_instantiate() { ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB); ColorModel colorModel; WritableRaster raster; int[] nBits = {8, 8, 8, 8}; int[] bOffs = {3, 2, 1, 0}; colorModel = new ComponentColorModel(cs, nBits, true, false, Transparency.... | ImageConversion { @Benchmark public BufferedImage ABGR_to_4ByteABGR_instantiate() { ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB); ColorModel colorModel; WritableRaster raster; int[] nBits = {8, 8, 8, 8}; int[] bOffs = {3, 2, 1, 0}; colorModel = new ComponentColorModel(cs, nBits, true, false, Transparency.... |
@Test public void displayText() throws Exception { new TextDisplay(senseHat).displayText("Hallo Welt!"); } | public void displayText(String text) throws IOException { BufferedImage image = new BufferedImage(8, 8, BufferedImage.TYPE_USHORT_565_RGB); Graphics2D graphics = image.createGraphics(); if (big) { text = text.toUpperCase(); } Font sansSerif = new Font("SansSerif", Font.PLAIN, big ? 10 : 8); graphics.setFont(sansSerif);... | TextDisplay { public void displayText(String text) throws IOException { BufferedImage image = new BufferedImage(8, 8, BufferedImage.TYPE_USHORT_565_RGB); Graphics2D graphics = image.createGraphics(); if (big) { text = text.toUpperCase(); } Font sansSerif = new Font("SansSerif", Font.PLAIN, big ? 10 : 8); graphics.setFo... | TextDisplay { public void displayText(String text) throws IOException { BufferedImage image = new BufferedImage(8, 8, BufferedImage.TYPE_USHORT_565_RGB); Graphics2D graphics = image.createGraphics(); if (big) { text = text.toUpperCase(); } Font sansSerif = new Font("SansSerif", Font.PLAIN, big ? 10 : 8); graphics.setFo... | TextDisplay { public void displayText(String text) throws IOException { BufferedImage image = new BufferedImage(8, 8, BufferedImage.TYPE_USHORT_565_RGB); Graphics2D graphics = image.createGraphics(); if (big) { text = text.toUpperCase(); } Font sansSerif = new Font("SansSerif", Font.PLAIN, big ? 10 : 8); graphics.setFo... | TextDisplay { public void displayText(String text) throws IOException { BufferedImage image = new BufferedImage(8, 8, BufferedImage.TYPE_USHORT_565_RGB); Graphics2D graphics = image.createGraphics(); if (big) { text = text.toUpperCase(); } Font sansSerif = new Font("SansSerif", Font.PLAIN, big ? 10 : 8); graphics.setFo... |
@Test public void testInt_red() { assertThat(SenseHatColor.fromRGB(0xFF, 0x00, 0x00).getSenseHatColor()).isEqualTo(0xF800); } | public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } | SenseHatColor { public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } } | SenseHatColor { public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } SenseHatColor(int senseHatColor); SenseHatColor(int r, int g, int b... | SenseHatColor { public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } SenseHatColor(int senseHatColor); SenseHatColor(int r, int g, int b... | SenseHatColor { public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } SenseHatColor(int senseHatColor); SenseHatColor(int r, int g, int b... |
@Test public void testDouble_red() { assertThat(SenseHatColor.fromRGB(1f ,0f, 0f).getSenseHatColor()).isEqualTo(0xF800); } | public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } | SenseHatColor { public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } } | SenseHatColor { public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } SenseHatColor(int senseHatColor); SenseHatColor(int r, int g, int b... | SenseHatColor { public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } SenseHatColor(int senseHatColor); SenseHatColor(int r, int g, int b... | SenseHatColor { public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } SenseHatColor(int senseHatColor); SenseHatColor(int r, int g, int b... |
@Test public void testString_red() { assertThat(SenseHatColor.fromString("red").getSenseHatColor()).isEqualTo(0xF800); assertThat(SenseHatColor.fromString("F00").getSenseHatColor()).isEqualTo(0xF800); assertThat(SenseHatColor.fromString("#F00").getSenseHatColor()).isEqualTo(0xF800); assertThat(SenseHatColor.fromString(... | public static SenseHatColor fromString(String color) { switch (color.toLowerCase()) { case "red": return RED; case "green": return GREEN; case "blue": return BLUE; case "yellow": return YELLOW; case "pink": case "magenta": return MAGENTA; case "cyan": return CYAN; case "white": return WHITE; case "black": return BLACK;... | SenseHatColor { public static SenseHatColor fromString(String color) { switch (color.toLowerCase()) { case "red": return RED; case "green": return GREEN; case "blue": return BLUE; case "yellow": return YELLOW; case "pink": case "magenta": return MAGENTA; case "cyan": return CYAN; case "white": return WHITE; case "black... | SenseHatColor { public static SenseHatColor fromString(String color) { switch (color.toLowerCase()) { case "red": return RED; case "green": return GREEN; case "blue": return BLUE; case "yellow": return YELLOW; case "pink": case "magenta": return MAGENTA; case "cyan": return CYAN; case "white": return WHITE; case "black... | SenseHatColor { public static SenseHatColor fromString(String color) { switch (color.toLowerCase()) { case "red": return RED; case "green": return GREEN; case "blue": return BLUE; case "yellow": return YELLOW; case "pink": case "magenta": return MAGENTA; case "cyan": return CYAN; case "white": return WHITE; case "black... | SenseHatColor { public static SenseHatColor fromString(String color) { switch (color.toLowerCase()) { case "red": return RED; case "green": return GREEN; case "blue": return BLUE; case "yellow": return YELLOW; case "pink": case "magenta": return MAGENTA; case "cyan": return CYAN; case "white": return WHITE; case "black... |
@Test public void testInt_blue() { assertThat(SenseHatColor.fromRGB(0x00, 0x00, 0xFF).getSenseHatColor()).isEqualTo(0x001F); } | public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } | SenseHatColor { public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } } | SenseHatColor { public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } SenseHatColor(int senseHatColor); SenseHatColor(int r, int g, int b... | SenseHatColor { public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } SenseHatColor(int senseHatColor); SenseHatColor(int r, int g, int b... | SenseHatColor { public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } SenseHatColor(int senseHatColor); SenseHatColor(int r, int g, int b... |
@Test public void testDouble_blue() { assertThat(SenseHatColor.fromRGB(0f ,0f, 1f).getSenseHatColor()).isEqualTo(0x001F); } | public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } | SenseHatColor { public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } } | SenseHatColor { public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } SenseHatColor(int senseHatColor); SenseHatColor(int r, int g, int b... | SenseHatColor { public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } SenseHatColor(int senseHatColor); SenseHatColor(int r, int g, int b... | SenseHatColor { public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } SenseHatColor(int senseHatColor); SenseHatColor(int r, int g, int b... |
@Test public void testString_blue() { assertThat(SenseHatColor.fromString("blue").getSenseHatColor()).isEqualTo(0x001F); assertThat(SenseHatColor.fromString("00F").getSenseHatColor()).isEqualTo(0x001F); assertThat(SenseHatColor.fromString("#00F").getSenseHatColor()).isEqualTo(0x001F); assertThat(SenseHatColor.fromStrin... | public static SenseHatColor fromString(String color) { switch (color.toLowerCase()) { case "red": return RED; case "green": return GREEN; case "blue": return BLUE; case "yellow": return YELLOW; case "pink": case "magenta": return MAGENTA; case "cyan": return CYAN; case "white": return WHITE; case "black": return BLACK;... | SenseHatColor { public static SenseHatColor fromString(String color) { switch (color.toLowerCase()) { case "red": return RED; case "green": return GREEN; case "blue": return BLUE; case "yellow": return YELLOW; case "pink": case "magenta": return MAGENTA; case "cyan": return CYAN; case "white": return WHITE; case "black... | SenseHatColor { public static SenseHatColor fromString(String color) { switch (color.toLowerCase()) { case "red": return RED; case "green": return GREEN; case "blue": return BLUE; case "yellow": return YELLOW; case "pink": case "magenta": return MAGENTA; case "cyan": return CYAN; case "white": return WHITE; case "black... | SenseHatColor { public static SenseHatColor fromString(String color) { switch (color.toLowerCase()) { case "red": return RED; case "green": return GREEN; case "blue": return BLUE; case "yellow": return YELLOW; case "pink": case "magenta": return MAGENTA; case "cyan": return CYAN; case "white": return WHITE; case "black... | SenseHatColor { public static SenseHatColor fromString(String color) { switch (color.toLowerCase()) { case "red": return RED; case "green": return GREEN; case "blue": return BLUE; case "yellow": return YELLOW; case "pink": case "magenta": return MAGENTA; case "cyan": return CYAN; case "white": return WHITE; case "black... |
@Test public void testPlus() { SenseHatColor white = SenseHatColor.fromString("FFF"); SenseHatColor black = SenseHatColor.fromString("000"); assertThat(white.plus(black)).isEqualTo(white); assertThat(white.plus(white)).isEqualTo(white); assertThat(black.plus(black)).isEqualTo(black); assertThat(SenseHatColor.fromString... | public SenseHatColor plus(SenseHatColor other) { int newRed = getRedRaw() + other.getRedRaw(); int newGreen = getGreenRaw() + other.getGreenRaw(); int newBlue = getBlueRaw() + other.getBlueRaw(); if (newRed > 31) { newRed = 31; } if (newGreen > 63) { newGreen = 63; } if (newBlue > 31) { newBlue = 31; } return new Sense... | SenseHatColor { public SenseHatColor plus(SenseHatColor other) { int newRed = getRedRaw() + other.getRedRaw(); int newGreen = getGreenRaw() + other.getGreenRaw(); int newBlue = getBlueRaw() + other.getBlueRaw(); if (newRed > 31) { newRed = 31; } if (newGreen > 63) { newGreen = 63; } if (newBlue > 31) { newBlue = 31; } ... | SenseHatColor { public SenseHatColor plus(SenseHatColor other) { int newRed = getRedRaw() + other.getRedRaw(); int newGreen = getGreenRaw() + other.getGreenRaw(); int newBlue = getBlueRaw() + other.getBlueRaw(); if (newRed > 31) { newRed = 31; } if (newGreen > 63) { newGreen = 63; } if (newBlue > 31) { newBlue = 31; } ... | SenseHatColor { public SenseHatColor plus(SenseHatColor other) { int newRed = getRedRaw() + other.getRedRaw(); int newGreen = getGreenRaw() + other.getGreenRaw(); int newBlue = getBlueRaw() + other.getBlueRaw(); if (newRed > 31) { newRed = 31; } if (newGreen > 63) { newGreen = 63; } if (newBlue > 31) { newBlue = 31; } ... | SenseHatColor { public SenseHatColor plus(SenseHatColor other) { int newRed = getRedRaw() + other.getRedRaw(); int newGreen = getGreenRaw() + other.getGreenRaw(); int newBlue = getBlueRaw() + other.getBlueRaw(); if (newRed > 31) { newRed = 31; } if (newGreen > 63) { newGreen = 63; } if (newBlue > 31) { newBlue = 31; } ... |
@Test public void testMix() { SenseHatColor white = SenseHatColor.fromString("FFF"); SenseHatColor black = SenseHatColor.fromString("000"); assertThat(white.mix(black)).isEqualTo(white.divide(2)); assertThat(white.mix(white)).isEqualTo(white); assertThat(black.mix(black)).isEqualTo(black); assertThat(SenseHatColor.from... | public SenseHatColor mix(SenseHatColor other) { if (this.equals(other)) { return this; } float newRed = (getRed() + other.getRed()) / 2f; float newGreen = (getGreen() + other.getGreen()) / 2f; float newBlue = (getBlue() + other.getBlue()) / 2f; return fromRGB(newRed, newGreen, newBlue); } | SenseHatColor { public SenseHatColor mix(SenseHatColor other) { if (this.equals(other)) { return this; } float newRed = (getRed() + other.getRed()) / 2f; float newGreen = (getGreen() + other.getGreen()) / 2f; float newBlue = (getBlue() + other.getBlue()) / 2f; return fromRGB(newRed, newGreen, newBlue); } } | SenseHatColor { public SenseHatColor mix(SenseHatColor other) { if (this.equals(other)) { return this; } float newRed = (getRed() + other.getRed()) / 2f; float newGreen = (getGreen() + other.getGreen()) / 2f; float newBlue = (getBlue() + other.getBlue()) / 2f; return fromRGB(newRed, newGreen, newBlue); } SenseHatColor(... | SenseHatColor { public SenseHatColor mix(SenseHatColor other) { if (this.equals(other)) { return this; } float newRed = (getRed() + other.getRed()) / 2f; float newGreen = (getGreen() + other.getGreen()) / 2f; float newBlue = (getBlue() + other.getBlue()) / 2f; return fromRGB(newRed, newGreen, newBlue); } SenseHatColor(... | SenseHatColor { public SenseHatColor mix(SenseHatColor other) { if (this.equals(other)) { return this; } float newRed = (getRed() + other.getRed()) / 2f; float newGreen = (getGreen() + other.getGreen()) / 2f; float newBlue = (getBlue() + other.getBlue()) / 2f; return fromRGB(newRed, newGreen, newBlue); } SenseHatColor(... |
@Test public void testGetRed() throws Exception { assertThat(new SenseHatColor(0xFFFF).getRed()).isEqualTo(1); assertThat(new SenseHatColor(0xF800).getRed()).isEqualTo(1); assertThat(new SenseHatColor(0x0000).getRed()).isEqualTo(0); } | public float getRed() { return getRedRaw() / 31f; } | SenseHatColor { public float getRed() { return getRedRaw() / 31f; } } | SenseHatColor { public float getRed() { return getRedRaw() / 31f; } SenseHatColor(int senseHatColor); SenseHatColor(int r, int g, int b); } | SenseHatColor { public float getRed() { return getRedRaw() / 31f; } SenseHatColor(int senseHatColor); SenseHatColor(int r, int g, int b); short getRedRaw(); float getRed(); SenseHatColor withRedRaw(short red); SenseHatColor withRed(float red); short getGreenRaw(); float getGreen(); SenseHatColor withGreenRaw(short gr... | SenseHatColor { public float getRed() { return getRedRaw() / 31f; } SenseHatColor(int senseHatColor); SenseHatColor(int r, int g, int b); short getRedRaw(); float getRed(); SenseHatColor withRedRaw(short red); SenseHatColor withRed(float red); short getGreenRaw(); float getGreen(); SenseHatColor withGreenRaw(short gr... |
@Test public void getGreen() throws Exception { assertThat(new SenseHatColor(0xFFFF).getGreen()).isEqualTo(1); assertThat(new SenseHatColor(0x07E0).getGreen()).isEqualTo(1); assertThat(new SenseHatColor(0x0000).getGreen()).isEqualTo(0); } | public float getGreen() { return getGreenRaw() / 63f; } | SenseHatColor { public float getGreen() { return getGreenRaw() / 63f; } } | SenseHatColor { public float getGreen() { return getGreenRaw() / 63f; } SenseHatColor(int senseHatColor); SenseHatColor(int r, int g, int b); } | SenseHatColor { public float getGreen() { return getGreenRaw() / 63f; } SenseHatColor(int senseHatColor); SenseHatColor(int r, int g, int b); short getRedRaw(); float getRed(); SenseHatColor withRedRaw(short red); SenseHatColor withRed(float red); short getGreenRaw(); float getGreen(); SenseHatColor withGreenRaw(shor... | SenseHatColor { public float getGreen() { return getGreenRaw() / 63f; } SenseHatColor(int senseHatColor); SenseHatColor(int r, int g, int b); short getRedRaw(); float getRed(); SenseHatColor withRedRaw(short red); SenseHatColor withRed(float red); short getGreenRaw(); float getGreen(); SenseHatColor withGreenRaw(shor... |
@Test public void getBlue() throws Exception { assertThat(new SenseHatColor(0xFFFF).getBlue()).isEqualTo(1); assertThat(new SenseHatColor(0x003F).getBlue()).isEqualTo(1); assertThat(new SenseHatColor(0x0000).getBlue()).isEqualTo(0); } | public float getBlue() { return getBlueRaw() / 31f; } | SenseHatColor { public float getBlue() { return getBlueRaw() / 31f; } } | SenseHatColor { public float getBlue() { return getBlueRaw() / 31f; } SenseHatColor(int senseHatColor); SenseHatColor(int r, int g, int b); } | SenseHatColor { public float getBlue() { return getBlueRaw() / 31f; } SenseHatColor(int senseHatColor); SenseHatColor(int r, int g, int b); short getRedRaw(); float getRed(); SenseHatColor withRedRaw(short red); SenseHatColor withRed(float red); short getGreenRaw(); float getGreen(); SenseHatColor withGreenRaw(short ... | SenseHatColor { public float getBlue() { return getBlueRaw() / 31f; } SenseHatColor(int senseHatColor); SenseHatColor(int r, int g, int b); short getRedRaw(); float getRed(); SenseHatColor withRedRaw(short red); SenseHatColor withRed(float red); short getGreenRaw(); float getGreen(); SenseHatColor withGreenRaw(short ... |
@Test public void testInt_white() { assertThat(SenseHatColor.fromRGB(0xFF, 0xFF, 0xFF).getSenseHatColor()).isEqualTo(0xFFFF); } | public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } | SenseHatColor { public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } } | SenseHatColor { public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } SenseHatColor(int senseHatColor); SenseHatColor(int r, int g, int b... | SenseHatColor { public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } SenseHatColor(int senseHatColor); SenseHatColor(int r, int g, int b... | SenseHatColor { public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } SenseHatColor(int senseHatColor); SenseHatColor(int r, int g, int b... |
@Test public void testDouble_white() { assertThat(SenseHatColor.fromRGB(1f ,1f, 1f).getSenseHatColor()).isEqualTo(0xFFFF); } | public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } | SenseHatColor { public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } } | SenseHatColor { public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } SenseHatColor(int senseHatColor); SenseHatColor(int r, int g, int b... | SenseHatColor { public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } SenseHatColor(int senseHatColor); SenseHatColor(int r, int g, int b... | SenseHatColor { public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } SenseHatColor(int senseHatColor); SenseHatColor(int r, int g, int b... |
@Test public void testString_white() { assertThat(SenseHatColor.fromString("white").getSenseHatColor()).isEqualTo(0xFFFF); assertThat(SenseHatColor.fromString("FFF").getSenseHatColor()).isEqualTo(0xFFFF); assertThat(SenseHatColor.fromString("fff").getSenseHatColor()).isEqualTo(0xFFFF); assertThat(SenseHatColor.fromStri... | public static SenseHatColor fromString(String color) { switch (color.toLowerCase()) { case "red": return RED; case "green": return GREEN; case "blue": return BLUE; case "yellow": return YELLOW; case "pink": case "magenta": return MAGENTA; case "cyan": return CYAN; case "white": return WHITE; case "black": return BLACK;... | SenseHatColor { public static SenseHatColor fromString(String color) { switch (color.toLowerCase()) { case "red": return RED; case "green": return GREEN; case "blue": return BLUE; case "yellow": return YELLOW; case "pink": case "magenta": return MAGENTA; case "cyan": return CYAN; case "white": return WHITE; case "black... | SenseHatColor { public static SenseHatColor fromString(String color) { switch (color.toLowerCase()) { case "red": return RED; case "green": return GREEN; case "blue": return BLUE; case "yellow": return YELLOW; case "pink": case "magenta": return MAGENTA; case "cyan": return CYAN; case "white": return WHITE; case "black... | SenseHatColor { public static SenseHatColor fromString(String color) { switch (color.toLowerCase()) { case "red": return RED; case "green": return GREEN; case "blue": return BLUE; case "yellow": return YELLOW; case "pink": case "magenta": return MAGENTA; case "cyan": return CYAN; case "white": return WHITE; case "black... | SenseHatColor { public static SenseHatColor fromString(String color) { switch (color.toLowerCase()) { case "red": return RED; case "green": return GREEN; case "blue": return BLUE; case "yellow": return YELLOW; case "pink": case "magenta": return MAGENTA; case "cyan": return CYAN; case "white": return WHITE; case "black... |
@Test public void testInt_black() { assertThat(SenseHatColor.fromRGB(0x00, 0x00, 0x00).getSenseHatColor()).isEqualTo(0x0000); } | public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } | SenseHatColor { public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } } | SenseHatColor { public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } SenseHatColor(int senseHatColor); SenseHatColor(int r, int g, int b... | SenseHatColor { public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } SenseHatColor(int senseHatColor); SenseHatColor(int r, int g, int b... | SenseHatColor { public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } SenseHatColor(int senseHatColor); SenseHatColor(int r, int g, int b... |
@Test public void testDouble_black() { assertThat(SenseHatColor.fromRGB(0f ,0f, 0f).getSenseHatColor()).isEqualTo(0x0000); } | public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } | SenseHatColor { public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } } | SenseHatColor { public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } SenseHatColor(int senseHatColor); SenseHatColor(int r, int g, int b... | SenseHatColor { public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } SenseHatColor(int senseHatColor); SenseHatColor(int r, int g, int b... | SenseHatColor { public static SenseHatColor fromRGB(int red, int green, int blue) { short r = (short) ((red >> 3) & 0b11111); short g = (short) ((green >> 2) & 0b111111); short b = (short) ((blue >> 3) & 0b11111); return new SenseHatColor(r, g, b); } SenseHatColor(int senseHatColor); SenseHatColor(int r, int g, int b... |
@Test public void testString_black() { assertThat(SenseHatColor.fromString("black").getSenseHatColor()).isEqualTo(0x0000); assertThat(SenseHatColor.fromString("000").getSenseHatColor()).isEqualTo(0x0000); assertThat(SenseHatColor.fromString("#000").getSenseHatColor()).isEqualTo(0x0000); assertThat(SenseHatColor.fromStr... | public static SenseHatColor fromString(String color) { switch (color.toLowerCase()) { case "red": return RED; case "green": return GREEN; case "blue": return BLUE; case "yellow": return YELLOW; case "pink": case "magenta": return MAGENTA; case "cyan": return CYAN; case "white": return WHITE; case "black": return BLACK;... | SenseHatColor { public static SenseHatColor fromString(String color) { switch (color.toLowerCase()) { case "red": return RED; case "green": return GREEN; case "blue": return BLUE; case "yellow": return YELLOW; case "pink": case "magenta": return MAGENTA; case "cyan": return CYAN; case "white": return WHITE; case "black... | SenseHatColor { public static SenseHatColor fromString(String color) { switch (color.toLowerCase()) { case "red": return RED; case "green": return GREEN; case "blue": return BLUE; case "yellow": return YELLOW; case "pink": case "magenta": return MAGENTA; case "cyan": return CYAN; case "white": return WHITE; case "black... | SenseHatColor { public static SenseHatColor fromString(String color) { switch (color.toLowerCase()) { case "red": return RED; case "green": return GREEN; case "blue": return BLUE; case "yellow": return YELLOW; case "pink": case "magenta": return MAGENTA; case "cyan": return CYAN; case "white": return WHITE; case "black... | SenseHatColor { public static SenseHatColor fromString(String color) { switch (color.toLowerCase()) { case "red": return RED; case "green": return GREEN; case "blue": return BLUE; case "yellow": return YELLOW; case "pink": case "magenta": return MAGENTA; case "cyan": return CYAN; case "white": return WHITE; case "black... |
@Test public void testRoute_ReturnFalse() { Router router = new ConditionRouterFactory().getRouter(getRouteUrl("host = " + NetUtils.getLocalHost() + " => false")); List<Invoker<String>> invokers = new ArrayList<Invoker<String>>(); invokers.add(new MockInvoker<String>()); invokers.add(new MockInvoker<String>()); invoker... | public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new ArrayList<Invoker<T>>(); if (thenCondition == null) { logger... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... | ConditionRouter implements Router, Comparable<Router> { public <T> List<Invoker<T>> route(List<Invoker<T>> invokers, URL url, Invocation invocation) throws RpcException { if (invokers == null || invokers.size() == 0) { return invokers; } try { if (!matchWhen(url)) { return invokers; } List<Invoker<T>> result = new Arra... |
@Test public void testDoRetry_subscribe() throws Exception { final CountDownLatch latch = new CountDownLatch(1); registry = new MockRegistry(registryUrl, latch); registry.setBad(true); registry.register(serviceUrl); registry.setBad(false); for (int i = 0; i < trytimes; i++) { System.out.println("failback registry retry... | @Override public void register(URL url) { super.register(url); failedRegistered.remove(url); failedUnregistered.remove(url); try { doRegister(url); } catch (Exception e) { Throwable t = e; boolean check = getUrl().getParameter(Constants.CHECK_KEY, true) && url.getParameter(Constants.CHECK_KEY, true) && !Constants.CONSU... | FailbackRegistry extends AbstractRegistry { @Override public void register(URL url) { super.register(url); failedRegistered.remove(url); failedUnregistered.remove(url); try { doRegister(url); } catch (Exception e) { Throwable t = e; boolean check = getUrl().getParameter(Constants.CHECK_KEY, true) && url.getParameter(Co... | FailbackRegistry extends AbstractRegistry { @Override public void register(URL url) { super.register(url); failedRegistered.remove(url); failedUnregistered.remove(url); try { doRegister(url); } catch (Exception e) { Throwable t = e; boolean check = getUrl().getParameter(Constants.CHECK_KEY, true) && url.getParameter(Co... | FailbackRegistry extends AbstractRegistry { @Override public void register(URL url) { super.register(url); failedRegistered.remove(url); failedUnregistered.remove(url); try { doRegister(url); } catch (Exception e) { Throwable t = e; boolean check = getUrl().getParameter(Constants.CHECK_KEY, true) && url.getParameter(Co... | FailbackRegistry extends AbstractRegistry { @Override public void register(URL url) { super.register(url); failedRegistered.remove(url); failedUnregistered.remove(url); try { doRegister(url); } catch (Exception e) { Throwable t = e; boolean check = getUrl().getParameter(Constants.CHECK_KEY, true) && url.getParameter(Co... |
@Test public void testDoRetry_register() throws Exception { final AtomicReference<Boolean> notified = new AtomicReference<Boolean>(false); final CountDownLatch latch = new CountDownLatch(1); NotifyListener listner = new NotifyListener() { public void notify(List<URL> urls) { notified.set(Boolean.TRUE); } }; registry = ... | @Override public void subscribe(URL url, NotifyListener listener) { super.subscribe(url, listener); removeFailedSubscribed(url, listener); try { doSubscribe(url, listener); } catch (Exception e) { Throwable t = e; List<URL> urls = getCacheUrls(url); if (urls != null && urls.size() > 0) { notify(url, listener, urls); lo... | FailbackRegistry extends AbstractRegistry { @Override public void subscribe(URL url, NotifyListener listener) { super.subscribe(url, listener); removeFailedSubscribed(url, listener); try { doSubscribe(url, listener); } catch (Exception e) { Throwable t = e; List<URL> urls = getCacheUrls(url); if (urls != null && urls.s... | FailbackRegistry extends AbstractRegistry { @Override public void subscribe(URL url, NotifyListener listener) { super.subscribe(url, listener); removeFailedSubscribed(url, listener); try { doSubscribe(url, listener); } catch (Exception e) { Throwable t = e; List<URL> urls = getCacheUrls(url); if (urls != null && urls.s... | FailbackRegistry extends AbstractRegistry { @Override public void subscribe(URL url, NotifyListener listener) { super.subscribe(url, listener); removeFailedSubscribed(url, listener); try { doSubscribe(url, listener); } catch (Exception e) { Throwable t = e; List<URL> urls = getCacheUrls(url); if (urls != null && urls.s... | FailbackRegistry extends AbstractRegistry { @Override public void subscribe(URL url, NotifyListener listener) { super.subscribe(url, listener); removeFailedSubscribed(url, listener); try { doSubscribe(url, listener); } catch (Exception e) { Throwable t = e; List<URL> urls = getCacheUrls(url); if (urls != null && urls.s... |
@Test public void testDoRetry_nofify() throws Exception { final AtomicInteger count = new AtomicInteger(0); NotifyListener listner = new NotifyListener() { public void notify(List<URL> urls) { count.incrementAndGet(); if (count.get() == 1l) { throw new RuntimeException("test exception please ignore"); } } }; registry =... | @Override public void subscribe(URL url, NotifyListener listener) { super.subscribe(url, listener); removeFailedSubscribed(url, listener); try { doSubscribe(url, listener); } catch (Exception e) { Throwable t = e; List<URL> urls = getCacheUrls(url); if (urls != null && urls.size() > 0) { notify(url, listener, urls); lo... | FailbackRegistry extends AbstractRegistry { @Override public void subscribe(URL url, NotifyListener listener) { super.subscribe(url, listener); removeFailedSubscribed(url, listener); try { doSubscribe(url, listener); } catch (Exception e) { Throwable t = e; List<URL> urls = getCacheUrls(url); if (urls != null && urls.s... | FailbackRegistry extends AbstractRegistry { @Override public void subscribe(URL url, NotifyListener listener) { super.subscribe(url, listener); removeFailedSubscribed(url, listener); try { doSubscribe(url, listener); } catch (Exception e) { Throwable t = e; List<URL> urls = getCacheUrls(url); if (urls != null && urls.s... | FailbackRegistry extends AbstractRegistry { @Override public void subscribe(URL url, NotifyListener listener) { super.subscribe(url, listener); removeFailedSubscribed(url, listener); try { doSubscribe(url, listener); } catch (Exception e) { Throwable t = e; List<URL> urls = getCacheUrls(url); if (urls != null && urls.s... | FailbackRegistry extends AbstractRegistry { @Override public void subscribe(URL url, NotifyListener listener) { super.subscribe(url, listener); removeFailedSubscribed(url, listener); try { doSubscribe(url, listener); } catch (Exception e) { Throwable t = e; List<URL> urls = getCacheUrls(url); if (urls != null && urls.s... |
@Test public void test_makeEmptyClass() throws Exception { Wrapper.getWrapper(EmptyServiceImpl.class); } | public static Wrapper getWrapper(Class<?> c) { while (ClassGenerator.isDynamicClass(c)) c = c.getSuperclass(); if (c == Object.class) return OBJECT_WRAPPER; Wrapper ret = WRAPPER_MAP.get(c); if (ret == null) { ret = makeWrapper(c); WRAPPER_MAP.put(c, ret); } return ret; } | Wrapper { public static Wrapper getWrapper(Class<?> c) { while (ClassGenerator.isDynamicClass(c)) c = c.getSuperclass(); if (c == Object.class) return OBJECT_WRAPPER; Wrapper ret = WRAPPER_MAP.get(c); if (ret == null) { ret = makeWrapper(c); WRAPPER_MAP.put(c, ret); } return ret; } } | Wrapper { public static Wrapper getWrapper(Class<?> c) { while (ClassGenerator.isDynamicClass(c)) c = c.getSuperclass(); if (c == Object.class) return OBJECT_WRAPPER; Wrapper ret = WRAPPER_MAP.get(c); if (ret == null) { ret = makeWrapper(c); WRAPPER_MAP.put(c, ret); } return ret; } } | Wrapper { public static Wrapper getWrapper(Class<?> c) { while (ClassGenerator.isDynamicClass(c)) c = c.getSuperclass(); if (c == Object.class) return OBJECT_WRAPPER; Wrapper ret = WRAPPER_MAP.get(c); if (ret == null) { ret = makeWrapper(c); WRAPPER_MAP.put(c, ret); } return ret; } static Wrapper getWrapper(Class<?> c... | Wrapper { public static Wrapper getWrapper(Class<?> c) { while (ClassGenerator.isDynamicClass(c)) c = c.getSuperclass(); if (c == Object.class) return OBJECT_WRAPPER; Wrapper ret = WRAPPER_MAP.get(c); if (ret == null) { ret = makeWrapper(c); WRAPPER_MAP.put(c, ret); } return ret; } static Wrapper getWrapper(Class<?> c... |
@Test public void test_valueOf_Exception_noProtocol() throws Exception { try { URL.valueOf(": fail(); } catch (IllegalStateException expected) { assertEquals("url missing protocol: \": } } | public static URL valueOf(String url) { if (url == null || (url = url.trim()).length() == 0) { throw new IllegalArgumentException("url == null"); } String protocol = null; String username = null; String password = null; String host = null; int port = 0; String path = null; Map<String, String> parameters = null; int i =... | URL implements Serializable { public static URL valueOf(String url) { if (url == null || (url = url.trim()).length() == 0) { throw new IllegalArgumentException("url == null"); } String protocol = null; String username = null; String password = null; String host = null; int port = 0; String path = null; Map<String, Stri... | URL implements Serializable { public static URL valueOf(String url) { if (url == null || (url = url.trim()).length() == 0) { throw new IllegalArgumentException("url == null"); } String protocol = null; String username = null; String password = null; String host = null; int port = 0; String path = null; Map<String, Stri... | URL implements Serializable { public static URL valueOf(String url) { if (url == null || (url = url.trim()).length() == 0) { throw new IllegalArgumentException("url == null"); } String protocol = null; String username = null; String password = null; String host = null; int port = 0; String path = null; Map<String, Stri... | URL implements Serializable { public static URL valueOf(String url) { if (url == null || (url = url.trim()).length() == 0) { throw new IllegalArgumentException("url == null"); } String protocol = null; String username = null; String password = null; String host = null; int port = 0; String path = null; Map<String, Stri... |
@Test public void test_equals() throws Exception { URL url1 = URL.valueOf("dubbo: Map<String, String> params = new HashMap<String, String>(); params.put("version", "1.0.0"); params.put("application", "morgan"); URL url2 = new URL("dubbo", "admin", "hello1234", "10.20.130.230", 20880, "context/path", params); assertEqua... | public static URL valueOf(String url) { if (url == null || (url = url.trim()).length() == 0) { throw new IllegalArgumentException("url == null"); } String protocol = null; String username = null; String password = null; String host = null; int port = 0; String path = null; Map<String, String> parameters = null; int i =... | URL implements Serializable { public static URL valueOf(String url) { if (url == null || (url = url.trim()).length() == 0) { throw new IllegalArgumentException("url == null"); } String protocol = null; String username = null; String password = null; String host = null; int port = 0; String path = null; Map<String, Stri... | URL implements Serializable { public static URL valueOf(String url) { if (url == null || (url = url.trim()).length() == 0) { throw new IllegalArgumentException("url == null"); } String protocol = null; String username = null; String password = null; String host = null; int port = 0; String path = null; Map<String, Stri... | URL implements Serializable { public static URL valueOf(String url) { if (url == null || (url = url.trim()).length() == 0) { throw new IllegalArgumentException("url == null"); } String protocol = null; String username = null; String password = null; String host = null; int port = 0; String path = null; Map<String, Stri... | URL implements Serializable { public static URL valueOf(String url) { if (url == null || (url = url.trim()).length() == 0) { throw new IllegalArgumentException("url == null"); } String protocol = null; String username = null; String password = null; String host = null; int port = 0; String path = null; Map<String, Stri... |
@Test public void testMergeValues() { List<String> merged = ConfigUtils.mergeValues(Serialization.class, "aaa,bbb,default.cunstom", toArray("dubbo", "default.hessian2", "json")); Assert.assertEquals(toArray("dubbo", "json", "aaa", "bbb", "default.cunstom"), merged); } | public static List<String> mergeValues(Class<?> type, String cfg, List<String> def) { List<String> defaults = new ArrayList<String>(); if (def != null) { for (String name : def) { if (ExtensionLoader.getExtensionLoader(type).hasExtension(name)) { defaults.add(name); } } } List<String> names = new ArrayList<String>(); S... | ConfigUtils { public static List<String> mergeValues(Class<?> type, String cfg, List<String> def) { List<String> defaults = new ArrayList<String>(); if (def != null) { for (String name : def) { if (ExtensionLoader.getExtensionLoader(type).hasExtension(name)) { defaults.add(name); } } } List<String> names = new ArrayLis... | ConfigUtils { public static List<String> mergeValues(Class<?> type, String cfg, List<String> def) { List<String> defaults = new ArrayList<String>(); if (def != null) { for (String name : def) { if (ExtensionLoader.getExtensionLoader(type).hasExtension(name)) { defaults.add(name); } } } List<String> names = new ArrayLis... | ConfigUtils { public static List<String> mergeValues(Class<?> type, String cfg, List<String> def) { List<String> defaults = new ArrayList<String>(); if (def != null) { for (String name : def) { if (ExtensionLoader.getExtensionLoader(type).hasExtension(name)) { defaults.add(name); } } } List<String> names = new ArrayLis... | ConfigUtils { public static List<String> mergeValues(Class<?> type, String cfg, List<String> def) { List<String> defaults = new ArrayList<String>(); if (def != null) { for (String name : def) { if (ExtensionLoader.getExtensionLoader(type).hasExtension(name)) { defaults.add(name); } } } List<String> names = new ArrayLis... |
@Test public void testMergeValues_addDefault() { List<String> merged = ConfigUtils.mergeValues(Serialization.class, "aaa,bbb,default,zzz", toArray("dubbo", "default.hessian2", "json")); Assert.assertEquals(toArray("aaa", "bbb", "dubbo", "json", "zzz"), merged); } | public static List<String> mergeValues(Class<?> type, String cfg, List<String> def) { List<String> defaults = new ArrayList<String>(); if (def != null) { for (String name : def) { if (ExtensionLoader.getExtensionLoader(type).hasExtension(name)) { defaults.add(name); } } } List<String> names = new ArrayList<String>(); S... | ConfigUtils { public static List<String> mergeValues(Class<?> type, String cfg, List<String> def) { List<String> defaults = new ArrayList<String>(); if (def != null) { for (String name : def) { if (ExtensionLoader.getExtensionLoader(type).hasExtension(name)) { defaults.add(name); } } } List<String> names = new ArrayLis... | ConfigUtils { public static List<String> mergeValues(Class<?> type, String cfg, List<String> def) { List<String> defaults = new ArrayList<String>(); if (def != null) { for (String name : def) { if (ExtensionLoader.getExtensionLoader(type).hasExtension(name)) { defaults.add(name); } } } List<String> names = new ArrayLis... | ConfigUtils { public static List<String> mergeValues(Class<?> type, String cfg, List<String> def) { List<String> defaults = new ArrayList<String>(); if (def != null) { for (String name : def) { if (ExtensionLoader.getExtensionLoader(type).hasExtension(name)) { defaults.add(name); } } } List<String> names = new ArrayLis... | ConfigUtils { public static List<String> mergeValues(Class<?> type, String cfg, List<String> def) { List<String> defaults = new ArrayList<String>(); if (def != null) { for (String name : def) { if (ExtensionLoader.getExtensionLoader(type).hasExtension(name)) { defaults.add(name); } } } List<String> names = new ArrayLis... |
@Test public void testMergeValuesDeleteDefault() { List<String> merged = ConfigUtils.mergeValues(Serialization.class, "-default", toArray("dubbo", "default.hessian2", "json")); Assert.assertEquals(toArray(), merged); } | public static List<String> mergeValues(Class<?> type, String cfg, List<String> def) { List<String> defaults = new ArrayList<String>(); if (def != null) { for (String name : def) { if (ExtensionLoader.getExtensionLoader(type).hasExtension(name)) { defaults.add(name); } } } List<String> names = new ArrayList<String>(); S... | ConfigUtils { public static List<String> mergeValues(Class<?> type, String cfg, List<String> def) { List<String> defaults = new ArrayList<String>(); if (def != null) { for (String name : def) { if (ExtensionLoader.getExtensionLoader(type).hasExtension(name)) { defaults.add(name); } } } List<String> names = new ArrayLis... | ConfigUtils { public static List<String> mergeValues(Class<?> type, String cfg, List<String> def) { List<String> defaults = new ArrayList<String>(); if (def != null) { for (String name : def) { if (ExtensionLoader.getExtensionLoader(type).hasExtension(name)) { defaults.add(name); } } } List<String> names = new ArrayLis... | ConfigUtils { public static List<String> mergeValues(Class<?> type, String cfg, List<String> def) { List<String> defaults = new ArrayList<String>(); if (def != null) { for (String name : def) { if (ExtensionLoader.getExtensionLoader(type).hasExtension(name)) { defaults.add(name); } } } List<String> names = new ArrayLis... | ConfigUtils { public static List<String> mergeValues(Class<?> type, String cfg, List<String> def) { List<String> defaults = new ArrayList<String>(); if (def != null) { for (String name : def) { if (ExtensionLoader.getExtensionLoader(type).hasExtension(name)) { defaults.add(name); } } } List<String> names = new ArrayLis... |
@Test public void testMergeValuesDeleteDefault_2() { List<String> merged = ConfigUtils.mergeValues(Serialization.class, "-default,aaa", toArray("dubbo", "default.hessian2", "json")); Assert.assertEquals(toArray("aaa"), merged); } | public static List<String> mergeValues(Class<?> type, String cfg, List<String> def) { List<String> defaults = new ArrayList<String>(); if (def != null) { for (String name : def) { if (ExtensionLoader.getExtensionLoader(type).hasExtension(name)) { defaults.add(name); } } } List<String> names = new ArrayList<String>(); S... | ConfigUtils { public static List<String> mergeValues(Class<?> type, String cfg, List<String> def) { List<String> defaults = new ArrayList<String>(); if (def != null) { for (String name : def) { if (ExtensionLoader.getExtensionLoader(type).hasExtension(name)) { defaults.add(name); } } } List<String> names = new ArrayLis... | ConfigUtils { public static List<String> mergeValues(Class<?> type, String cfg, List<String> def) { List<String> defaults = new ArrayList<String>(); if (def != null) { for (String name : def) { if (ExtensionLoader.getExtensionLoader(type).hasExtension(name)) { defaults.add(name); } } } List<String> names = new ArrayLis... | ConfigUtils { public static List<String> mergeValues(Class<?> type, String cfg, List<String> def) { List<String> defaults = new ArrayList<String>(); if (def != null) { for (String name : def) { if (ExtensionLoader.getExtensionLoader(type).hasExtension(name)) { defaults.add(name); } } } List<String> names = new ArrayLis... | ConfigUtils { public static List<String> mergeValues(Class<?> type, String cfg, List<String> def) { List<String> defaults = new ArrayList<String>(); if (def != null) { for (String name : def) { if (ExtensionLoader.getExtensionLoader(type).hasExtension(name)) { defaults.add(name); } } } List<String> names = new ArrayLis... |
@Test public void testMergeValuesDelete() { List<String> merged = ConfigUtils.mergeValues(Serialization.class, "-dubbo,aaa", toArray("dubbo", "default.hessian2", "json")); Assert.assertEquals(toArray("json", "aaa"), merged); } | public static List<String> mergeValues(Class<?> type, String cfg, List<String> def) { List<String> defaults = new ArrayList<String>(); if (def != null) { for (String name : def) { if (ExtensionLoader.getExtensionLoader(type).hasExtension(name)) { defaults.add(name); } } } List<String> names = new ArrayList<String>(); S... | ConfigUtils { public static List<String> mergeValues(Class<?> type, String cfg, List<String> def) { List<String> defaults = new ArrayList<String>(); if (def != null) { for (String name : def) { if (ExtensionLoader.getExtensionLoader(type).hasExtension(name)) { defaults.add(name); } } } List<String> names = new ArrayLis... | ConfigUtils { public static List<String> mergeValues(Class<?> type, String cfg, List<String> def) { List<String> defaults = new ArrayList<String>(); if (def != null) { for (String name : def) { if (ExtensionLoader.getExtensionLoader(type).hasExtension(name)) { defaults.add(name); } } } List<String> names = new ArrayLis... | ConfigUtils { public static List<String> mergeValues(Class<?> type, String cfg, List<String> def) { List<String> defaults = new ArrayList<String>(); if (def != null) { for (String name : def) { if (ExtensionLoader.getExtensionLoader(type).hasExtension(name)) { defaults.add(name); } } } List<String> names = new ArrayLis... | ConfigUtils { public static List<String> mergeValues(Class<?> type, String cfg, List<String> def) { List<String> defaults = new ArrayList<String>(); if (def != null) { for (String name : def) { if (ExtensionLoader.getExtensionLoader(type).hasExtension(name)) { defaults.add(name); } } } List<String> names = new ArrayLis... |
@Test public void test_loadProperties_noFile() throws Exception { Properties p = ConfigUtils.loadProperties("notExisted", true); Properties expected = new Properties(); Assert.assertEquals(expected, p); p = ConfigUtils.loadProperties("notExisted", false); Assert.assertEquals(expected, p); } | public static Properties loadProperties(String fileName) { return loadProperties(fileName, false, false); } | ConfigUtils { public static Properties loadProperties(String fileName) { return loadProperties(fileName, false, false); } } | ConfigUtils { public static Properties loadProperties(String fileName) { return loadProperties(fileName, false, false); } private ConfigUtils(); } | ConfigUtils { public static Properties loadProperties(String fileName) { return loadProperties(fileName, false, false); } private ConfigUtils(); static boolean isNotEmpty(String value); static boolean isEmpty(String value); static boolean isDefault(String value); static List<String> mergeValues(Class<?> type, String c... | ConfigUtils { public static Properties loadProperties(String fileName) { return loadProperties(fileName, false, false); } private ConfigUtils(); static boolean isNotEmpty(String value); static boolean isEmpty(String value); static boolean isDefault(String value); static List<String> mergeValues(Class<?> type, String c... |
@Test public void testSelect_Invokersize0() throws Exception { { Invoker invoker = cluster.select(null, null, null, null); Assert.assertEquals(null, invoker); } { invokers.clear(); selectedInvokers.clear(); Invoker invoker = cluster.select(null, null, invokers, null); Assert.assertEquals(null, invoker); } } | protected Invoker<T> select(LoadBalance loadbalance, Invocation invocation, List<Invoker<T>> invokers, List<Invoker<T>> selected) throws RpcException { if (invokers == null || invokers.size() == 0) return null; String methodName = invocation == null ? "" : invocation.getMethodName(); boolean sticky = invokers.get(0).ge... | AbstractClusterInvoker implements Invoker<T> { protected Invoker<T> select(LoadBalance loadbalance, Invocation invocation, List<Invoker<T>> invokers, List<Invoker<T>> selected) throws RpcException { if (invokers == null || invokers.size() == 0) return null; String methodName = invocation == null ? "" : invocation.getMe... | AbstractClusterInvoker implements Invoker<T> { protected Invoker<T> select(LoadBalance loadbalance, Invocation invocation, List<Invoker<T>> invokers, List<Invoker<T>> selected) throws RpcException { if (invokers == null || invokers.size() == 0) return null; String methodName = invocation == null ? "" : invocation.getMe... | AbstractClusterInvoker implements Invoker<T> { protected Invoker<T> select(LoadBalance loadbalance, Invocation invocation, List<Invoker<T>> invokers, List<Invoker<T>> selected) throws RpcException { if (invokers == null || invokers.size() == 0) return null; String methodName = invocation == null ? "" : invocation.getMe... | AbstractClusterInvoker implements Invoker<T> { protected Invoker<T> select(LoadBalance loadbalance, Invocation invocation, List<Invoker<T>> invokers, List<Invoker<T>> selected) throws RpcException { if (invokers == null || invokers.size() == 0) return null; String methodName = invocation == null ? "" : invocation.getMe... |
@Test public void test_loadProperties_oneFile() throws Exception { Properties p = ConfigUtils.loadProperties("properties.load", false); Properties expected = new Properties(); expected.put("a", "12"); expected.put("b", "34"); expected.put("c", "56"); Assert.assertEquals(expected, p); } | public static Properties loadProperties(String fileName) { return loadProperties(fileName, false, false); } | ConfigUtils { public static Properties loadProperties(String fileName) { return loadProperties(fileName, false, false); } } | ConfigUtils { public static Properties loadProperties(String fileName) { return loadProperties(fileName, false, false); } private ConfigUtils(); } | ConfigUtils { public static Properties loadProperties(String fileName) { return loadProperties(fileName, false, false); } private ConfigUtils(); static boolean isNotEmpty(String value); static boolean isEmpty(String value); static boolean isDefault(String value); static List<String> mergeValues(Class<?> type, String c... | ConfigUtils { public static Properties loadProperties(String fileName) { return loadProperties(fileName, false, false); } private ConfigUtils(); static boolean isNotEmpty(String value); static boolean isEmpty(String value); static boolean isDefault(String value); static List<String> mergeValues(Class<?> type, String c... |
@Test public void test_loadProperties_oneFile_allowMulti() throws Exception { Properties p = ConfigUtils.loadProperties("properties.load", true); Properties expected = new Properties(); expected.put("a", "12"); expected.put("b", "34"); expected.put("c", "56"); Assert.assertEquals(expected, p); } | public static Properties loadProperties(String fileName) { return loadProperties(fileName, false, false); } | ConfigUtils { public static Properties loadProperties(String fileName) { return loadProperties(fileName, false, false); } } | ConfigUtils { public static Properties loadProperties(String fileName) { return loadProperties(fileName, false, false); } private ConfigUtils(); } | ConfigUtils { public static Properties loadProperties(String fileName) { return loadProperties(fileName, false, false); } private ConfigUtils(); static boolean isNotEmpty(String value); static boolean isEmpty(String value); static boolean isDefault(String value); static List<String> mergeValues(Class<?> type, String c... | ConfigUtils { public static Properties loadProperties(String fileName) { return loadProperties(fileName, false, false); } private ConfigUtils(); static boolean isNotEmpty(String value); static boolean isEmpty(String value); static boolean isDefault(String value); static List<String> mergeValues(Class<?> type, String c... |
@Test public void test_loadProperties_oneFile_notRootPath() throws Exception { Properties p = ConfigUtils.loadProperties("META-INF/dubbo/internal/com.alibaba.dubbo.common.threadpool.ThreadPool", false); Properties expected = new Properties(); expected.put("fixed", "com.alibaba.dubbo.common.threadpool.support.fixed.Fixe... | public static Properties loadProperties(String fileName) { return loadProperties(fileName, false, false); } | ConfigUtils { public static Properties loadProperties(String fileName) { return loadProperties(fileName, false, false); } } | ConfigUtils { public static Properties loadProperties(String fileName) { return loadProperties(fileName, false, false); } private ConfigUtils(); } | ConfigUtils { public static Properties loadProperties(String fileName) { return loadProperties(fileName, false, false); } private ConfigUtils(); static boolean isNotEmpty(String value); static boolean isEmpty(String value); static boolean isDefault(String value); static List<String> mergeValues(Class<?> type, String c... | ConfigUtils { public static Properties loadProperties(String fileName) { return loadProperties(fileName, false, false); } private ConfigUtils(); static boolean isNotEmpty(String value); static boolean isEmpty(String value); static boolean isDefault(String value); static List<String> mergeValues(Class<?> type, String c... |
@Ignore("see http: @Test public void test_loadProperties_multiFile_notRootPath_Exception() throws Exception { try { ConfigUtils.loadProperties("META-INF/services/com.alibaba.dubbo.common.status.StatusChecker", false); Assert.fail(); } catch (IllegalStateException expected) { assertThat(expected.getMessage(), containsSt... | public static Properties loadProperties(String fileName) { return loadProperties(fileName, false, false); } | ConfigUtils { public static Properties loadProperties(String fileName) { return loadProperties(fileName, false, false); } } | ConfigUtils { public static Properties loadProperties(String fileName) { return loadProperties(fileName, false, false); } private ConfigUtils(); } | ConfigUtils { public static Properties loadProperties(String fileName) { return loadProperties(fileName, false, false); } private ConfigUtils(); static boolean isNotEmpty(String value); static boolean isEmpty(String value); static boolean isDefault(String value); static List<String> mergeValues(Class<?> type, String c... | ConfigUtils { public static Properties loadProperties(String fileName) { return loadProperties(fileName, false, false); } private ConfigUtils(); static boolean isNotEmpty(String value); static boolean isEmpty(String value); static boolean isDefault(String value); static List<String> mergeValues(Class<?> type, String c... |
@Test public void test_loadProperties_multiFile_notRootPath() throws Exception { Properties p = ConfigUtils.loadProperties("META-INF/dubbo/internal/com.alibaba.dubbo.common.status.StatusChecker", true); Properties expected = new Properties(); expected.put("memory", "com.alibaba.dubbo.common.status.support.MemoryStatusC... | public static Properties loadProperties(String fileName) { return loadProperties(fileName, false, false); } | ConfigUtils { public static Properties loadProperties(String fileName) { return loadProperties(fileName, false, false); } } | ConfigUtils { public static Properties loadProperties(String fileName) { return loadProperties(fileName, false, false); } private ConfigUtils(); } | ConfigUtils { public static Properties loadProperties(String fileName) { return loadProperties(fileName, false, false); } private ConfigUtils(); static boolean isNotEmpty(String value); static boolean isEmpty(String value); static boolean isDefault(String value); static List<String> mergeValues(Class<?> type, String c... | ConfigUtils { public static Properties loadProperties(String fileName) { return loadProperties(fileName, false, false); } private ConfigUtils(); static boolean isNotEmpty(String value); static boolean isEmpty(String value); static boolean isDefault(String value); static List<String> mergeValues(Class<?> type, String c... |
@Test public void test_realize_LongPararmter_IllegalArgumentException() throws Exception { Method method = PojoUtilsTest.class.getMethod("setLong", long.class); assertNotNull(method); Object value = PojoUtils.realize("563439743927993", method.getParameterTypes()[0], method.getGenericParameterTypes()[0]); method.invoke(... | public static Object[] realize(Object[] objs, Class<?>[] types) { if (objs.length != types.length) throw new IllegalArgumentException("args.length != types.length"); Object[] dests = new Object[objs.length]; for (int i = 0; i < objs.length; i++) { dests[i] = realize(objs[i], types[i]); } return dests; } | PojoUtils { public static Object[] realize(Object[] objs, Class<?>[] types) { if (objs.length != types.length) throw new IllegalArgumentException("args.length != types.length"); Object[] dests = new Object[objs.length]; for (int i = 0; i < objs.length; i++) { dests[i] = realize(objs[i], types[i]); } return dests; } } | PojoUtils { public static Object[] realize(Object[] objs, Class<?>[] types) { if (objs.length != types.length) throw new IllegalArgumentException("args.length != types.length"); Object[] dests = new Object[objs.length]; for (int i = 0; i < objs.length; i++) { dests[i] = realize(objs[i], types[i]); } return dests; } } | PojoUtils { public static Object[] realize(Object[] objs, Class<?>[] types) { if (objs.length != types.length) throw new IllegalArgumentException("args.length != types.length"); Object[] dests = new Object[objs.length]; for (int i = 0; i < objs.length; i++) { dests[i] = realize(objs[i], types[i]); } return dests; } st... | PojoUtils { public static Object[] realize(Object[] objs, Class<?>[] types) { if (objs.length != types.length) throw new IllegalArgumentException("args.length != types.length"); Object[] dests = new Object[objs.length]; for (int i = 0; i < objs.length; i++) { dests[i] = realize(objs[i], types[i]); } return dests; } st... |
@Test public void test_realize_IntPararmter_IllegalArgumentException() throws Exception { Method method = PojoUtilsTest.class.getMethod("setInt", int.class); assertNotNull(method); Object value = PojoUtils.realize("123", method.getParameterTypes()[0], method.getGenericParameterTypes()[0]); method.invoke(new PojoUtilsTe... | public static Object[] realize(Object[] objs, Class<?>[] types) { if (objs.length != types.length) throw new IllegalArgumentException("args.length != types.length"); Object[] dests = new Object[objs.length]; for (int i = 0; i < objs.length; i++) { dests[i] = realize(objs[i], types[i]); } return dests; } | PojoUtils { public static Object[] realize(Object[] objs, Class<?>[] types) { if (objs.length != types.length) throw new IllegalArgumentException("args.length != types.length"); Object[] dests = new Object[objs.length]; for (int i = 0; i < objs.length; i++) { dests[i] = realize(objs[i], types[i]); } return dests; } } | PojoUtils { public static Object[] realize(Object[] objs, Class<?>[] types) { if (objs.length != types.length) throw new IllegalArgumentException("args.length != types.length"); Object[] dests = new Object[objs.length]; for (int i = 0; i < objs.length; i++) { dests[i] = realize(objs[i], types[i]); } return dests; } } | PojoUtils { public static Object[] realize(Object[] objs, Class<?>[] types) { if (objs.length != types.length) throw new IllegalArgumentException("args.length != types.length"); Object[] dests = new Object[objs.length]; for (int i = 0; i < objs.length; i++) { dests[i] = realize(objs[i], types[i]); } return dests; } st... | PojoUtils { public static Object[] realize(Object[] objs, Class<?>[] types) { if (objs.length != types.length) throw new IllegalArgumentException("args.length != types.length"); Object[] dests = new Object[objs.length]; for (int i = 0; i < objs.length; i++) { dests[i] = realize(objs[i], types[i]); } return dests; } st... |
@Test public void testRealize() throws Exception { Map<String, String> inputMap = new LinkedHashMap<String, String>(); inputMap.put("key", "value"); Object obj = PojoUtils.generalize(inputMap); Assert.assertTrue(obj instanceof LinkedHashMap); Object outputObject = PojoUtils.realize(inputMap, LinkedHashMap.class); Syste... | public static Object[] realize(Object[] objs, Class<?>[] types) { if (objs.length != types.length) throw new IllegalArgumentException("args.length != types.length"); Object[] dests = new Object[objs.length]; for (int i = 0; i < objs.length; i++) { dests[i] = realize(objs[i], types[i]); } return dests; } | PojoUtils { public static Object[] realize(Object[] objs, Class<?>[] types) { if (objs.length != types.length) throw new IllegalArgumentException("args.length != types.length"); Object[] dests = new Object[objs.length]; for (int i = 0; i < objs.length; i++) { dests[i] = realize(objs[i], types[i]); } return dests; } } | PojoUtils { public static Object[] realize(Object[] objs, Class<?>[] types) { if (objs.length != types.length) throw new IllegalArgumentException("args.length != types.length"); Object[] dests = new Object[objs.length]; for (int i = 0; i < objs.length; i++) { dests[i] = realize(objs[i], types[i]); } return dests; } } | PojoUtils { public static Object[] realize(Object[] objs, Class<?>[] types) { if (objs.length != types.length) throw new IllegalArgumentException("args.length != types.length"); Object[] dests = new Object[objs.length]; for (int i = 0; i < objs.length; i++) { dests[i] = realize(objs[i], types[i]); } return dests; } st... | PojoUtils { public static Object[] realize(Object[] objs, Class<?>[] types) { if (objs.length != types.length) throw new IllegalArgumentException("args.length != types.length"); Object[] dests = new Object[objs.length]; for (int i = 0; i < objs.length; i++) { dests[i] = realize(objs[i], types[i]); } return dests; } st... |
@SuppressWarnings("unchecked") @Test public void testCompatibleTypeConvert() throws Exception { Object result; { Object input = new Object(); result = CompatibleTypeUtils.compatibleTypeConvert(input, Date.class); assertSame(input, result); result = CompatibleTypeUtils.compatibleTypeConvert(input, null); assertSame(inpu... | @SuppressWarnings({"unchecked", "rawtypes"}) public static Object compatibleTypeConvert(Object value, Class<?> type) { if (value == null || type == null || type.isAssignableFrom(value.getClass())) { return value; } if (value instanceof String) { String string = (String) value; if (char.class.equals(type) || Character.c... | CompatibleTypeUtils { @SuppressWarnings({"unchecked", "rawtypes"}) public static Object compatibleTypeConvert(Object value, Class<?> type) { if (value == null || type == null || type.isAssignableFrom(value.getClass())) { return value; } if (value instanceof String) { String string = (String) value; if (char.class.equal... | CompatibleTypeUtils { @SuppressWarnings({"unchecked", "rawtypes"}) public static Object compatibleTypeConvert(Object value, Class<?> type) { if (value == null || type == null || type.isAssignableFrom(value.getClass())) { return value; } if (value instanceof String) { String string = (String) value; if (char.class.equal... | CompatibleTypeUtils { @SuppressWarnings({"unchecked", "rawtypes"}) public static Object compatibleTypeConvert(Object value, Class<?> type) { if (value == null || type == null || type.isAssignableFrom(value.getClass())) { return value; } if (value instanceof String) { String string = (String) value; if (char.class.equal... | CompatibleTypeUtils { @SuppressWarnings({"unchecked", "rawtypes"}) public static Object compatibleTypeConvert(Object value, Class<?> type) { if (value == null || type == null || type.isAssignableFrom(value.getClass())) { return value; } if (value instanceof String) { String string = (String) value; if (char.class.equal... |
@Test public void test_findMethodByMethodSignature_override_Morethan1() throws Exception { try { ReflectUtils.findMethodByMethodSignature(TestedClass.class, "overrideMethod", null); fail(); } catch (IllegalStateException expected) { assertThat(expected.getMessage(), containsString( "Not unique method for method name(")... | public static Method findMethodByMethodSignature(Class<?> clazz, String methodName, String[] parameterTypes) throws NoSuchMethodException, ClassNotFoundException { String signature = methodName; if (parameterTypes != null && parameterTypes.length > 0) { signature = methodName + StringUtils.join(parameterTypes); } Metho... | ReflectUtils { public static Method findMethodByMethodSignature(Class<?> clazz, String methodName, String[] parameterTypes) throws NoSuchMethodException, ClassNotFoundException { String signature = methodName; if (parameterTypes != null && parameterTypes.length > 0) { signature = methodName + StringUtils.join(parameter... | ReflectUtils { public static Method findMethodByMethodSignature(Class<?> clazz, String methodName, String[] parameterTypes) throws NoSuchMethodException, ClassNotFoundException { String signature = methodName; if (parameterTypes != null && parameterTypes.length > 0) { signature = methodName + StringUtils.join(parameter... | ReflectUtils { public static Method findMethodByMethodSignature(Class<?> clazz, String methodName, String[] parameterTypes) throws NoSuchMethodException, ClassNotFoundException { String signature = methodName; if (parameterTypes != null && parameterTypes.length > 0) { signature = methodName + StringUtils.join(parameter... | ReflectUtils { public static Method findMethodByMethodSignature(Class<?> clazz, String methodName, String[] parameterTypes) throws NoSuchMethodException, ClassNotFoundException { String signature = methodName; if (parameterTypes != null && parameterTypes.length > 0) { signature = methodName + StringUtils.join(parameter... |
@Test public void testSelect_Invokersize1() throws Exception { invokers.clear(); invokers.add(invoker1); Invoker invoker = cluster.select(null, null, invokers, null); Assert.assertEquals(invoker1, invoker); } | protected Invoker<T> select(LoadBalance loadbalance, Invocation invocation, List<Invoker<T>> invokers, List<Invoker<T>> selected) throws RpcException { if (invokers == null || invokers.size() == 0) return null; String methodName = invocation == null ? "" : invocation.getMethodName(); boolean sticky = invokers.get(0).ge... | AbstractClusterInvoker implements Invoker<T> { protected Invoker<T> select(LoadBalance loadbalance, Invocation invocation, List<Invoker<T>> invokers, List<Invoker<T>> selected) throws RpcException { if (invokers == null || invokers.size() == 0) return null; String methodName = invocation == null ? "" : invocation.getMe... | AbstractClusterInvoker implements Invoker<T> { protected Invoker<T> select(LoadBalance loadbalance, Invocation invocation, List<Invoker<T>> invokers, List<Invoker<T>> selected) throws RpcException { if (invokers == null || invokers.size() == 0) return null; String methodName = invocation == null ? "" : invocation.getMe... | AbstractClusterInvoker implements Invoker<T> { protected Invoker<T> select(LoadBalance loadbalance, Invocation invocation, List<Invoker<T>> invokers, List<Invoker<T>> selected) throws RpcException { if (invokers == null || invokers.size() == 0) return null; String methodName = invocation == null ? "" : invocation.getMe... | AbstractClusterInvoker implements Invoker<T> { protected Invoker<T> select(LoadBalance loadbalance, Invocation invocation, List<Invoker<T>> invokers, List<Invoker<T>> selected) throws RpcException { if (invokers == null || invokers.size() == 0) return null; String methodName = invocation == null ? "" : invocation.getMe... |
@Test public void test_findMethodByMethodSignature_notFound() throws Exception { try { ReflectUtils.findMethodByMethodSignature(TestedClass.class, "notExsited", null); fail(); } catch (NoSuchMethodException expected) { assertThat(expected.getMessage(), containsString("No such method ")); assertThat(expected.getMessage(... | public static Method findMethodByMethodSignature(Class<?> clazz, String methodName, String[] parameterTypes) throws NoSuchMethodException, ClassNotFoundException { String signature = methodName; if (parameterTypes != null && parameterTypes.length > 0) { signature = methodName + StringUtils.join(parameterTypes); } Metho... | ReflectUtils { public static Method findMethodByMethodSignature(Class<?> clazz, String methodName, String[] parameterTypes) throws NoSuchMethodException, ClassNotFoundException { String signature = methodName; if (parameterTypes != null && parameterTypes.length > 0) { signature = methodName + StringUtils.join(parameter... | ReflectUtils { public static Method findMethodByMethodSignature(Class<?> clazz, String methodName, String[] parameterTypes) throws NoSuchMethodException, ClassNotFoundException { String signature = methodName; if (parameterTypes != null && parameterTypes.length > 0) { signature = methodName + StringUtils.join(parameter... | ReflectUtils { public static Method findMethodByMethodSignature(Class<?> clazz, String methodName, String[] parameterTypes) throws NoSuchMethodException, ClassNotFoundException { String signature = methodName; if (parameterTypes != null && parameterTypes.length > 0) { signature = methodName + StringUtils.join(parameter... | ReflectUtils { public static Method findMethodByMethodSignature(Class<?> clazz, String methodName, String[] parameterTypes) throws NoSuchMethodException, ClassNotFoundException { String signature = methodName; if (parameterTypes != null && parameterTypes.length > 0) { signature = methodName + StringUtils.join(parameter... |
@Test public void test_getEmptyObject() throws Exception { assertTrue(ReflectUtils.getEmptyObject(Collection.class) instanceof Collection); assertTrue(ReflectUtils.getEmptyObject(List.class) instanceof List); assertTrue(ReflectUtils.getEmptyObject(Set.class) instanceof Set); assertTrue(ReflectUtils.getEmptyObject(Map.c... | public static Object getEmptyObject(Class<?> returnType) { return getEmptyObject(returnType, new HashMap<Class<?>, Object>(), 0); } | ReflectUtils { public static Object getEmptyObject(Class<?> returnType) { return getEmptyObject(returnType, new HashMap<Class<?>, Object>(), 0); } } | ReflectUtils { public static Object getEmptyObject(Class<?> returnType) { return getEmptyObject(returnType, new HashMap<Class<?>, Object>(), 0); } private ReflectUtils(); } | ReflectUtils { public static Object getEmptyObject(Class<?> returnType) { return getEmptyObject(returnType, new HashMap<Class<?>, Object>(), 0); } private ReflectUtils(); static boolean isPrimitives(Class<?> cls); static boolean isPrimitive(Class<?> cls); static Class<?> getBoxedClass(Class<?> c); static boolean isCom... | ReflectUtils { public static Object getEmptyObject(Class<?> returnType) { return getEmptyObject(returnType, new HashMap<Class<?>, Object>(), 0); } private ReflectUtils(); static boolean isPrimitives(Class<?> cls); static boolean isPrimitive(Class<?> cls); static Class<?> getBoxedClass(Class<?> c); static boolean isCom... |
@Test public void testSelect_Invokersize2AndselectNotNull() throws Exception { invokers.clear(); invokers.add(invoker1); invokers.add(invoker2); { selectedInvokers.clear(); selectedInvokers.add(invoker1); Invoker invoker = cluster.select(null, null, invokers, selectedInvokers); Assert.assertEquals(invoker2, invoker); }... | protected Invoker<T> select(LoadBalance loadbalance, Invocation invocation, List<Invoker<T>> invokers, List<Invoker<T>> selected) throws RpcException { if (invokers == null || invokers.size() == 0) return null; String methodName = invocation == null ? "" : invocation.getMethodName(); boolean sticky = invokers.get(0).ge... | AbstractClusterInvoker implements Invoker<T> { protected Invoker<T> select(LoadBalance loadbalance, Invocation invocation, List<Invoker<T>> invokers, List<Invoker<T>> selected) throws RpcException { if (invokers == null || invokers.size() == 0) return null; String methodName = invocation == null ? "" : invocation.getMe... | AbstractClusterInvoker implements Invoker<T> { protected Invoker<T> select(LoadBalance loadbalance, Invocation invocation, List<Invoker<T>> invokers, List<Invoker<T>> selected) throws RpcException { if (invokers == null || invokers.size() == 0) return null; String methodName = invocation == null ? "" : invocation.getMe... | AbstractClusterInvoker implements Invoker<T> { protected Invoker<T> select(LoadBalance loadbalance, Invocation invocation, List<Invoker<T>> invokers, List<Invoker<T>> selected) throws RpcException { if (invokers == null || invokers.size() == 0) return null; String methodName = invocation == null ? "" : invocation.getMe... | AbstractClusterInvoker implements Invoker<T> { protected Invoker<T> select(LoadBalance loadbalance, Invocation invocation, List<Invoker<T>> invokers, List<Invoker<T>> selected) throws RpcException { if (invokers == null || invokers.size() == 0) return null; String methodName = invocation == null ? "" : invocation.getMe... |
@Test public void testRevertForbid() { String service = "dubbo.test.api.HelloService"; List<String> forbid = new ArrayList<String>(); forbid.add(service); Set<URL> subscribed = new HashSet<URL>(); subscribed.add(URL.valueOf("dubbo: List<String> newForbid = UrlUtils.revertForbid(forbid, subscribed); List<String> expectF... | public static List<String> revertForbid(List<String> forbid, Set<URL> subscribed) { if (forbid != null && forbid.size() > 0) { List<String> newForbid = new ArrayList<String>(); for (String serviceName : forbid) { if (!serviceName.contains(":") && !serviceName.contains("/")) { for (URL url : subscribed) { if (serviceNam... | UrlUtils { public static List<String> revertForbid(List<String> forbid, Set<URL> subscribed) { if (forbid != null && forbid.size() > 0) { List<String> newForbid = new ArrayList<String>(); for (String serviceName : forbid) { if (!serviceName.contains(":") && !serviceName.contains("/")) { for (URL url : subscribed) { if ... | UrlUtils { public static List<String> revertForbid(List<String> forbid, Set<URL> subscribed) { if (forbid != null && forbid.size() > 0) { List<String> newForbid = new ArrayList<String>(); for (String serviceName : forbid) { if (!serviceName.contains(":") && !serviceName.contains("/")) { for (URL url : subscribed) { if ... | UrlUtils { public static List<String> revertForbid(List<String> forbid, Set<URL> subscribed) { if (forbid != null && forbid.size() > 0) { List<String> newForbid = new ArrayList<String>(); for (String serviceName : forbid) { if (!serviceName.contains(":") && !serviceName.contains("/")) { for (URL url : subscribed) { if ... | UrlUtils { public static List<String> revertForbid(List<String> forbid, Set<URL> subscribed) { if (forbid != null && forbid.size() > 0) { List<String> newForbid = new ArrayList<String>(); for (String serviceName : forbid) { if (!serviceName.contains(":") && !serviceName.contains("/")) { for (URL url : subscribed) { if ... |
@Test public void testDonotSelectAgainAndNoCheckAvailable() { LoadBalance lb = ExtensionLoader.getExtensionLoader(LoadBalance.class).getExtension(RoundRobinLoadBalance.NAME); initlistsize5(); { selectedInvokers.clear(); selectedInvokers.add(invoker2); selectedInvokers.add(invoker3); selectedInvokers.add(invoker4); sele... | protected Invoker<T> select(LoadBalance loadbalance, Invocation invocation, List<Invoker<T>> invokers, List<Invoker<T>> selected) throws RpcException { if (invokers == null || invokers.size() == 0) return null; String methodName = invocation == null ? "" : invocation.getMethodName(); boolean sticky = invokers.get(0).ge... | AbstractClusterInvoker implements Invoker<T> { protected Invoker<T> select(LoadBalance loadbalance, Invocation invocation, List<Invoker<T>> invokers, List<Invoker<T>> selected) throws RpcException { if (invokers == null || invokers.size() == 0) return null; String methodName = invocation == null ? "" : invocation.getMe... | AbstractClusterInvoker implements Invoker<T> { protected Invoker<T> select(LoadBalance loadbalance, Invocation invocation, List<Invoker<T>> invokers, List<Invoker<T>> selected) throws RpcException { if (invokers == null || invokers.size() == 0) return null; String methodName = invocation == null ? "" : invocation.getMe... | AbstractClusterInvoker implements Invoker<T> { protected Invoker<T> select(LoadBalance loadbalance, Invocation invocation, List<Invoker<T>> invokers, List<Invoker<T>> selected) throws RpcException { if (invokers == null || invokers.size() == 0) return null; String methodName = invocation == null ? "" : invocation.getMe... | AbstractClusterInvoker implements Invoker<T> { protected Invoker<T> select(LoadBalance loadbalance, Invocation invocation, List<Invoker<T>> invokers, List<Invoker<T>> selected) throws RpcException { if (invokers == null || invokers.size() == 0) return null; String methodName = invocation == null ? "" : invocation.getMe... |
@Test public void testRevertForbid2() { List<String> newForbid = UrlUtils.revertForbid(null, null); assertNull(newForbid); } | public static List<String> revertForbid(List<String> forbid, Set<URL> subscribed) { if (forbid != null && forbid.size() > 0) { List<String> newForbid = new ArrayList<String>(); for (String serviceName : forbid) { if (!serviceName.contains(":") && !serviceName.contains("/")) { for (URL url : subscribed) { if (serviceNam... | UrlUtils { public static List<String> revertForbid(List<String> forbid, Set<URL> subscribed) { if (forbid != null && forbid.size() > 0) { List<String> newForbid = new ArrayList<String>(); for (String serviceName : forbid) { if (!serviceName.contains(":") && !serviceName.contains("/")) { for (URL url : subscribed) { if ... | UrlUtils { public static List<String> revertForbid(List<String> forbid, Set<URL> subscribed) { if (forbid != null && forbid.size() > 0) { List<String> newForbid = new ArrayList<String>(); for (String serviceName : forbid) { if (!serviceName.contains(":") && !serviceName.contains("/")) { for (URL url : subscribed) { if ... | UrlUtils { public static List<String> revertForbid(List<String> forbid, Set<URL> subscribed) { if (forbid != null && forbid.size() > 0) { List<String> newForbid = new ArrayList<String>(); for (String serviceName : forbid) { if (!serviceName.contains(":") && !serviceName.contains("/")) { for (URL url : subscribed) { if ... | UrlUtils { public static List<String> revertForbid(List<String> forbid, Set<URL> subscribed) { if (forbid != null && forbid.size() > 0) { List<String> newForbid = new ArrayList<String>(); for (String serviceName : forbid) { if (!serviceName.contains(":") && !serviceName.contains("/")) { for (URL url : subscribed) { if ... |
@Test public void testRevertForbid3() { String service1 = "dubbo.test.api.HelloService:1.0.0"; String service2 = "dubbo.test.api.HelloService:2.0.0"; List<String> forbid = new ArrayList<String>(); forbid.add(service1); forbid.add(service2); List<String> newForbid = UrlUtils.revertForbid(forbid, null); assertEquals(forb... | public static List<String> revertForbid(List<String> forbid, Set<URL> subscribed) { if (forbid != null && forbid.size() > 0) { List<String> newForbid = new ArrayList<String>(); for (String serviceName : forbid) { if (!serviceName.contains(":") && !serviceName.contains("/")) { for (URL url : subscribed) { if (serviceNam... | UrlUtils { public static List<String> revertForbid(List<String> forbid, Set<URL> subscribed) { if (forbid != null && forbid.size() > 0) { List<String> newForbid = new ArrayList<String>(); for (String serviceName : forbid) { if (!serviceName.contains(":") && !serviceName.contains("/")) { for (URL url : subscribed) { if ... | UrlUtils { public static List<String> revertForbid(List<String> forbid, Set<URL> subscribed) { if (forbid != null && forbid.size() > 0) { List<String> newForbid = new ArrayList<String>(); for (String serviceName : forbid) { if (!serviceName.contains(":") && !serviceName.contains("/")) { for (URL url : subscribed) { if ... | UrlUtils { public static List<String> revertForbid(List<String> forbid, Set<URL> subscribed) { if (forbid != null && forbid.size() > 0) { List<String> newForbid = new ArrayList<String>(); for (String serviceName : forbid) { if (!serviceName.contains(":") && !serviceName.contains("/")) { for (URL url : subscribed) { if ... | UrlUtils { public static List<String> revertForbid(List<String> forbid, Set<URL> subscribed) { if (forbid != null && forbid.size() > 0) { List<String> newForbid = new ArrayList<String>(); for (String serviceName : forbid) { if (!serviceName.contains(":") && !serviceName.contains("/")) { for (URL url : subscribed) { if ... |
@Test public void testIsMatch() { URL consumerUrl = URL.valueOf("dubbo: URL providerUrl = URL.valueOf("http: assertTrue(UrlUtils.isMatch(consumerUrl, providerUrl)); } | public static boolean isMatch(URL consumerUrl, URL providerUrl) { String consumerInterface = consumerUrl.getServiceInterface(); String providerInterface = providerUrl.getServiceInterface(); if (!(Constants.ANY_VALUE.equals(consumerInterface) || StringUtils.isEquals(consumerInterface, providerInterface))) return false; ... | UrlUtils { public static boolean isMatch(URL consumerUrl, URL providerUrl) { String consumerInterface = consumerUrl.getServiceInterface(); String providerInterface = providerUrl.getServiceInterface(); if (!(Constants.ANY_VALUE.equals(consumerInterface) || StringUtils.isEquals(consumerInterface, providerInterface))) ret... | UrlUtils { public static boolean isMatch(URL consumerUrl, URL providerUrl) { String consumerInterface = consumerUrl.getServiceInterface(); String providerInterface = providerUrl.getServiceInterface(); if (!(Constants.ANY_VALUE.equals(consumerInterface) || StringUtils.isEquals(consumerInterface, providerInterface))) ret... | UrlUtils { public static boolean isMatch(URL consumerUrl, URL providerUrl) { String consumerInterface = consumerUrl.getServiceInterface(); String providerInterface = providerUrl.getServiceInterface(); if (!(Constants.ANY_VALUE.equals(consumerInterface) || StringUtils.isEquals(consumerInterface, providerInterface))) ret... | UrlUtils { public static boolean isMatch(URL consumerUrl, URL providerUrl) { String consumerInterface = consumerUrl.getServiceInterface(); String providerInterface = providerUrl.getServiceInterface(); if (!(Constants.ANY_VALUE.equals(consumerInterface) || StringUtils.isEquals(consumerInterface, providerInterface))) ret... |
@Test public void testIsMatch2() { URL consumerUrl = URL.valueOf("dubbo: URL providerUrl = URL.valueOf("http: assertFalse(UrlUtils.isMatch(consumerUrl, providerUrl)); } | public static boolean isMatch(URL consumerUrl, URL providerUrl) { String consumerInterface = consumerUrl.getServiceInterface(); String providerInterface = providerUrl.getServiceInterface(); if (!(Constants.ANY_VALUE.equals(consumerInterface) || StringUtils.isEquals(consumerInterface, providerInterface))) return false; ... | UrlUtils { public static boolean isMatch(URL consumerUrl, URL providerUrl) { String consumerInterface = consumerUrl.getServiceInterface(); String providerInterface = providerUrl.getServiceInterface(); if (!(Constants.ANY_VALUE.equals(consumerInterface) || StringUtils.isEquals(consumerInterface, providerInterface))) ret... | UrlUtils { public static boolean isMatch(URL consumerUrl, URL providerUrl) { String consumerInterface = consumerUrl.getServiceInterface(); String providerInterface = providerUrl.getServiceInterface(); if (!(Constants.ANY_VALUE.equals(consumerInterface) || StringUtils.isEquals(consumerInterface, providerInterface))) ret... | UrlUtils { public static boolean isMatch(URL consumerUrl, URL providerUrl) { String consumerInterface = consumerUrl.getServiceInterface(); String providerInterface = providerUrl.getServiceInterface(); if (!(Constants.ANY_VALUE.equals(consumerInterface) || StringUtils.isEquals(consumerInterface, providerInterface))) ret... | UrlUtils { public static boolean isMatch(URL consumerUrl, URL providerUrl) { String consumerInterface = consumerUrl.getServiceInterface(); String providerInterface = providerUrl.getServiceInterface(); if (!(Constants.ANY_VALUE.equals(consumerInterface) || StringUtils.isEquals(consumerInterface, providerInterface))) ret... |
@Test public void testIsMatch3() { URL consumerUrl = URL.valueOf("dubbo: URL providerUrl = URL.valueOf("http: assertFalse(UrlUtils.isMatch(consumerUrl, providerUrl)); } | public static boolean isMatch(URL consumerUrl, URL providerUrl) { String consumerInterface = consumerUrl.getServiceInterface(); String providerInterface = providerUrl.getServiceInterface(); if (!(Constants.ANY_VALUE.equals(consumerInterface) || StringUtils.isEquals(consumerInterface, providerInterface))) return false; ... | UrlUtils { public static boolean isMatch(URL consumerUrl, URL providerUrl) { String consumerInterface = consumerUrl.getServiceInterface(); String providerInterface = providerUrl.getServiceInterface(); if (!(Constants.ANY_VALUE.equals(consumerInterface) || StringUtils.isEquals(consumerInterface, providerInterface))) ret... | UrlUtils { public static boolean isMatch(URL consumerUrl, URL providerUrl) { String consumerInterface = consumerUrl.getServiceInterface(); String providerInterface = providerUrl.getServiceInterface(); if (!(Constants.ANY_VALUE.equals(consumerInterface) || StringUtils.isEquals(consumerInterface, providerInterface))) ret... | UrlUtils { public static boolean isMatch(URL consumerUrl, URL providerUrl) { String consumerInterface = consumerUrl.getServiceInterface(); String providerInterface = providerUrl.getServiceInterface(); if (!(Constants.ANY_VALUE.equals(consumerInterface) || StringUtils.isEquals(consumerInterface, providerInterface))) ret... | UrlUtils { public static boolean isMatch(URL consumerUrl, URL providerUrl) { String consumerInterface = consumerUrl.getServiceInterface(); String providerInterface = providerUrl.getServiceInterface(); if (!(Constants.ANY_VALUE.equals(consumerInterface) || StringUtils.isEquals(consumerInterface, providerInterface))) ret... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.