protected IBspNode<ArrayList<Triangle>, AxisAlignedPlane3D> readNode( ObjectInputStream in ) throws IOException { boolean isInternal = in.readBoolean(); if ( isInternal ) { BspInternalNode<ArrayList<Triangle>, AxisAlignedPlane3D> internalNode = bspTree.makeInternalNode(); Axis3D axis = Axis3D.values()[in.readInt()]; double origin = in.readDouble(); internalNode.setBoundary( new AxisAlignedPlane3D( axis, origin) ); internalNode.setNegativeChild( readNode(in) ); internalNode.setPositiveChild( readNode(in) ); return internalNode; } else { BspLeafNode<ArrayList<Triangle>, AxisAlignedPlane3D> leafNode = bspTree.makeLeafNode(); int triangleCount = in.readInt(); ArrayList<Triangle> data = Lists.newArrayList(); while ( data.size() < triangleCount ) { data.add( triangles.get( in.readInt() ) ); } leafNode.setData( data ); return leafNode; } }
@Test public void cluster_status_parsed_successfully() throws SolrServerException, IOException { final String[] nodeIds = new String[] { "node1", "node2", "node3", "node4" }; solrCluster.startSolrNodes("node1", "node2", "node3", "node4"); initCluster(); createAlias(); addOverseerRole(); final CollectionAdminRequest.ClusterStatus clusterStatusRequest = new CollectionAdminRequest.ClusterStatus(); final CollectionAdminResponse response = clusterStatusRequest.process(solrClient); final ClusterStatusResponse clusterStatusResponse = new ClusterStatusResponse(response); assertResponseLiveNodes(nodeIds, clusterStatusResponse); assertThat(clusterStatusResponse.getAliases()).isEqualTo(ImmutableMap.of("both", "collection1,collection2")); assertThat(clusterStatusResponse.getRoles()).isEqualTo( ImmutableMap.of("overseer", Lists.newArrayList( SolrCloudUtils.baseUrlToNodeName(solrCluster.getBaseUrl("node1")), SolrCloudUtils.baseUrlToNodeName(solrCluster.getBaseUrl("node2"))))); final Map<String, Collection> collections = clusterStatusResponse.getCollections(); assertThat(collections.size()).isEqualTo(2); assertResponseCollection1(collections.get("collection1")); assertResponseCollection2(collections.get("collection2")); }
public void testRun() throws Exception { String nextId = "123"; BrowserRunnerStub browserRunner = new BrowserRunnerStub(); Set<BrowserRunner> browsers = Sets.<BrowserRunner>newHashSet(browserRunner); BrowserInfo browserInfo = new BrowserInfo(); browserInfo.setId(Long.parseLong(nextId)); browserInfo.setServerReceivedHeartbeat(true); browserInfo.setReady(true); Collection<BrowserInfo> capturedBrowsers = Lists.newArrayList(browserInfo); String serverAddress = "http://localhost"; BrowserStartupAction action = new BrowserStartupAction(browsers, new NullStopWatch(), new FakeJsTestDriverClient(capturedBrowsers, nextId), serverAddress, Executors.newSingleThreadExecutor()); action.run(new RunData(Collections.<ResponseStream>emptyList(), Collections.<JstdTestCase>emptyList(), null)); assertEquals(serverAddress + "/capture/id/123/timeout/10/upload_size/0/", browserRunner.serverAddress); }
protected void readObject(ObjectInputStream in) throws IOException { loaded = in.readBoolean(); ArrayList<Point3D> allVertices = Lists.newArrayList(); int vertexCount = in.readInt(); while ( allVertices.size() < vertexCount ) { double x = in.readDouble(); double y = in.readDouble(); double z = in.readDouble(); allVertices.add( new Point3D( x, y, z ) ); } triangles = Lists.newArrayList(); int triangleCount = in.readInt(); while ( triangles.size() < triangleCount ) { Point3D triangleVertices[] = new Point3D[3]; for ( int i=0; i<3; ++i ) { triangleVertices[i] = allVertices.get( in.readInt() ); } triangles.add( new Triangle( triangleVertices[0], triangleVertices[1], triangleVertices[2] ) ); } bspTree = BspTree.make( new RayCastBspStrategy( this, new Random(250760834l) ) ); rayCaster = new RayCaster( bspTree ); bspTree.setRoot( readNode( in ) ); }
@Override public List<EdgeDescriptor> getEdges(Integer polygon) { ArrayList<EdgeDescriptor> retval = Lists.newArrayList(); for (int i=0; i<polygonAnalysis.polygonIdToInfoMap.get(polygon).vertexIds.size(); ++i) { retval.add( new EdgeDescriptor( polygon, i) ); } return retval; }
public void saveReferenceResults( List<RaycastRequest> requests, String filename ) { ArrayList<PrecomputedRaycastResult> results = Lists.newArrayList(); for ( RaycastRequest request : requests ) { RaycastResult result = raycast( request.from, request.to ); results.add( new PrecomputedRaycastResult( request.from, request.to, (result.hit ? result.hitDistance : Double.NaN ) ) ); } RaycastDataFileTools.save( results, filename ); }
@Override public Iterable<StorageMetadata> list() { final List<StorageMetadata> metadatas = Lists.newArrayList(); for (final Map.Entry<String, File> fileEntry : this.nameToFile.entrySet()) { final StorageMetadata metadata = new StorageMetadata(); metadata.setHandle(CaArrayUtils.makeUriQuietly(SCHEME, fileEntry.getKey())); metadata.setCreationTimestamp(new Date(fileEntry.getValue().lastModified())); metadata.setCompressedSize(fileEntry.getValue().length()); metadata.setUncompressedSize(fileEntry.getValue().length()); metadatas.add(metadata); } return metadatas; }
private List<PageProvider> getNotificationPages() { return Lists.newArrayList( new PageProvider(ConfirmRegistrationHtmlNotificationDemoPage.class), new PageProvider(ResetPasswordHtmlNotificationDemoPage.class), new PageProvider(ConfirmEmailHtmlNotificationDemoPage.class), new PageProvider(DeleteEmailHtmlNotificationDemoPage.class), new PageProvider(NewVersionsHtmlNotificationDemoPage.class), new PageProvider(NewVersionsAdditionalEmailHtmlNotificationDemoPage.class) ); }
@Override protected List<ArtifactDeprecationStatus> load() { List<ArtifactDeprecationStatus> list = Lists.newArrayList(); Collections.addAll(list, ArtifactDeprecationStatus.values()); return list; }
@Override public ILinkParameterValidator mandatoryValidator() { return new SimpleMandatoryLinkParameterValidator( Lists.newArrayList(GROUP_ID_PARAMETER, ARTIFACT_ID_PARAMETER), Collections.singletonList(artifactModel)); }