@Test public void testApplyBasicPDF() throws IOException, ParserConfigurationException, SAXException, LexerException, SecurityException, NoSuchMethodException { StatisticsAccessLog aclog = EasyMock .createMock(StatisticsAccessLog.class); ProcessingIndexFeeder feeder = createMock(ProcessingIndexFeeder.class); CacheManager cacheManager = CacheManagerBuilder.newCacheManagerBuilder().build(); cacheManager.init(); HazelcastServerNode.ensureHazelcastNode(); FedoraAccessAkubraImpl fa = createMockBuilder(FedoraAccessAkubraImpl.class) .withConstructor(KConfiguration.getInstance(), feeder, aclog, cacheManager) .addMockedMethod("isStreamAvailable") .addMockedMethod("getRelsExt") .createMock(); narodniListyRelsExt(fa); drobnustkyRelsExt(fa); SolrAccess sa = createMockBuilder(SolrAccessImpl.class) .addMockedMethod( SolrAccess.class.getMethod("request", String.class, String.class)).createMock(); SolrMemoization memo = EasyMock.createMock(SolrMemoization.class); EasyMock.expect(memo.getRememberedIndexedDoc(DataPrepare.DROBNUSTKY_PIDS[0])).andReturn(null); EasyMock.expect(memo.askForIndexDocument(DataPrepare.DROBNUSTKY_PIDS[0])).andReturn(null); HttpServletRequest request = EasyMock .createMock(HttpServletRequest.class); HttpServletResponse response = EasyMock .createMock(HttpServletResponse.class); replay(fa, aclog, sa, memo, request, response); Injector injector = Guice.createInjector(new JSONDecTestModule(sa, memo, fa, request, response)); JSONDecoratorsAggregate aggregate = injector .getInstance(JSONDecoratorsAggregate.class); List<JSONDecorator> list = aggregate.getDecorators(); String pid = DataPrepare.DROBNUSTKY_PIDS[0] + "@2"; String basicUrl = ItemResource.basicURL(pid); List<JSONDecorator> acceptedDecorators = new ArrayList<JSONDecorator>(); for (JSONDecorator jsonDec : list) { JSONObject jsonObject = new JSONObject(); jsonObject.put("pid", pid); jsonObject.put("model", "page"); if (jsonDec.apply(jsonObject, basicUrl)) { acceptedDecorators.add(jsonDec); } } Assert.assertTrue(acceptedDecorators.size() == 13); }
public List<JSONDecorator> getDecorators() { List<JSONDecorator> decorators = new ArrayList<JSONDecorator>(); for (String k : this.keys) { decorators.add(this.decoratorsMap.get(k)); } return decorators; }
JSONDecoratorsAggregate { public List<JSONDecorator> getDecorators() { List<JSONDecorator> decorators = new ArrayList<JSONDecorator>(); for (String k : this.keys) { decorators.add(this.decoratorsMap.get(k)); } return decorators; } }
JSONDecoratorsAggregate { public List<JSONDecorator> getDecorators() { List<JSONDecorator> decorators = new ArrayList<JSONDecorator>(); for (String k : this.keys) { decorators.add(this.decoratorsMap.get(k)); } return decorators; } @Inject  JSONDecoratorsAggregate(Set<JSONDecorator> decs); }
JSONDecoratorsAggregate { public List<JSONDecorator> getDecorators() { List<JSONDecorator> decorators = new ArrayList<JSONDecorator>(); for (String k : this.keys) { decorators.add(this.decoratorsMap.get(k)); } return decorators; } @Inject  JSONDecoratorsAggregate(Set<JSONDecorator> decs); List<JSONDecorator> getDecorators(); }
JSONDecoratorsAggregate { public List<JSONDecorator> getDecorators() { List<JSONDecorator> decorators = new ArrayList<JSONDecorator>(); for (String k : this.keys) { decorators.add(this.decoratorsMap.get(k)); } return decorators; } @Inject  JSONDecoratorsAggregate(Set<JSONDecorator> decs); List<JSONDecorator> getDecorators();  }