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 testMemoryOnOffHeapRatio() throws Exception { assumeNonMaprProfile(); YarnController controller = Mockito.mock(YarnController.class); YarnService yarnService = new YarnService(new TestListener(), controller, Mockito.mock(NodeProvider.class)); Cluster cluster = new Cluster(); cluster.setState(ClusterState.CREATED); cluster.setStateChangeTime(System.currentTimeMillis()); cluster.setId(new ClusterId(UUID.randomUUID().toString())); ClusterConfig clusterConfig = new ClusterConfig(); List<Property> propertyList = new ArrayList<>(); propertyList.add(new Property(FS_DEFAULT_NAME_KEY, "hdfs: propertyList.add(new Property(RM_HOSTNAME, "resource-manager")); propertyList.add(new Property(DremioConfig.DIST_WRITE_PATH_STRING, "pdfs: RunId runId = RunIds.generate(); clusterConfig.setSubPropertyList(propertyList); cluster.setClusterConfig(clusterConfig); cluster.setRunId(new com.dremio.provision.RunId(runId.toString())); YarnConfiguration yarnConfig = new YarnConfiguration(); List<ClusterSpec> specs = Lists.asList(new ClusterSpec().setContainerCount(2).setMemoryMBOffHeap(96000).setMemoryMBOnHeap(4096).setVirtualCoreCount(2), new ClusterSpec[] {new ClusterSpec().setContainerCount(2).setMemoryMBOffHeap(96023).setMemoryMBOnHeap(1234).setVirtualCoreCount(2), new ClusterSpec().setContainerCount(2).setMemoryMBOffHeap(8192).setMemoryMBOnHeap(4096).setVirtualCoreCount(2), new ClusterSpec().setContainerCount(2).setMemoryMBOffHeap(72000).setMemoryMBOnHeap(8192).setVirtualCoreCount(2)}); for (ClusterSpec spec : specs) { clusterConfig.setClusterSpec(spec); int onHeapMemory = spec.getMemoryMBOnHeap(); int offHeapMemory = spec.getMemoryMBOffHeap(); yarnService.updateYarnConfiguration(cluster, yarnConfig); double ratio = ((double) onHeapMemory) / (offHeapMemory + onHeapMemory); if (ratio < 0.1) { assertEquals(ratio, yarnConfig.getDouble(HEAP_RESERVED_MIN_RATIO, 0), 10e-6); } else { assertEquals(0.1, yarnConfig.getDouble(HEAP_RESERVED_MIN_RATIO, 0), 10e-9); } assertEquals(onHeapMemory, Resources.computeMaxHeapSize(offHeapMemory + onHeapMemory, offHeapMemory, yarnConfig.getDouble(HEAP_RESERVED_MIN_RATIO, 0))); assertEquals(onHeapMemory, yarnConfig.getInt(DacDaemonYarnApplication.YARN_MEMORY_ON_HEAP, 0)); assertEquals(offHeapMemory, yarnConfig.getInt(DacDaemonYarnApplication.YARN_MEMORY_OFF_HEAP, 0)); assertEquals(offHeapMemory, yarnConfig.getInt(JAVA_RESERVED_MEMORY_MB, 0)); } } | @VisibleForTesting protected String updateYarnConfiguration(Cluster cluster, YarnConfiguration yarnConfiguration) { String rmAddress = null; setYarnDefaults(cluster, yarnConfiguration); List<Property> keyValues = cluster.getClusterConfig().getSubPropertyList(); if ( keyValues != null && !keyValues.isEmpty()) { for (Property property : keyValues) { yarnConfiguration.set(property.getKey(), property.getValue()); if (RM_HOSTNAME.equalsIgnoreCase(property.getKey())) { rmAddress = property.getValue(); } } } String queue = cluster.getClusterConfig().getClusterSpec().getQueue(); if (queue != null && !queue.isEmpty()) { yarnConfiguration.set(DacDaemonYarnApplication.YARN_QUEUE_NAME, queue); } Integer memoryOnHeap = cluster.getClusterConfig().getClusterSpec().getMemoryMBOnHeap(); Integer memoryOffHeap = cluster.getClusterConfig().getClusterSpec().getMemoryMBOffHeap(); Preconditions.checkNotNull(memoryOnHeap, "Heap Memory is not specified"); Preconditions.checkNotNull(memoryOffHeap, "Direct Memory is not specified"); final int totalMemory = memoryOnHeap.intValue() + memoryOffHeap.intValue(); final double heapToDirectMemRatio = (double) (memoryOnHeap.intValue()) / totalMemory; yarnConfiguration.setDouble(HEAP_RESERVED_MIN_RATIO, Math.min(heapToDirectMemRatio, 0.1D)); yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_MEMORY_ON_HEAP, memoryOnHeap.intValue()); yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_MEMORY_OFF_HEAP, memoryOffHeap.intValue()); yarnConfiguration.setInt(JAVA_RESERVED_MEMORY_MB, memoryOffHeap.intValue()); Integer cpu = cluster.getClusterConfig().getClusterSpec().getVirtualCoreCount(); if (cpu != null) { yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_CPU, cpu.intValue()); } Integer containerCount = cluster.getClusterConfig().getClusterSpec().getContainerCount(); if (containerCount != null) { yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_CONTAINER_COUNT, containerCount.intValue()); } String clusterName = cluster.getClusterConfig().getName(); if (clusterName != null) { yarnConfiguration.set(DacDaemonYarnApplication.YARN_APP_NAME, clusterName); } yarnConfiguration.set(YARN_CLUSTER_ID, cluster.getId().getId()); return rmAddress; } | YarnService implements ProvisioningServiceDelegate { @VisibleForTesting protected String updateYarnConfiguration(Cluster cluster, YarnConfiguration yarnConfiguration) { String rmAddress = null; setYarnDefaults(cluster, yarnConfiguration); List<Property> keyValues = cluster.getClusterConfig().getSubPropertyList(); if ( keyValues != null && !keyValues.isEmpty()) { for (Property property : keyValues) { yarnConfiguration.set(property.getKey(), property.getValue()); if (RM_HOSTNAME.equalsIgnoreCase(property.getKey())) { rmAddress = property.getValue(); } } } String queue = cluster.getClusterConfig().getClusterSpec().getQueue(); if (queue != null && !queue.isEmpty()) { yarnConfiguration.set(DacDaemonYarnApplication.YARN_QUEUE_NAME, queue); } Integer memoryOnHeap = cluster.getClusterConfig().getClusterSpec().getMemoryMBOnHeap(); Integer memoryOffHeap = cluster.getClusterConfig().getClusterSpec().getMemoryMBOffHeap(); Preconditions.checkNotNull(memoryOnHeap, "Heap Memory is not specified"); Preconditions.checkNotNull(memoryOffHeap, "Direct Memory is not specified"); final int totalMemory = memoryOnHeap.intValue() + memoryOffHeap.intValue(); final double heapToDirectMemRatio = (double) (memoryOnHeap.intValue()) / totalMemory; yarnConfiguration.setDouble(HEAP_RESERVED_MIN_RATIO, Math.min(heapToDirectMemRatio, 0.1D)); yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_MEMORY_ON_HEAP, memoryOnHeap.intValue()); yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_MEMORY_OFF_HEAP, memoryOffHeap.intValue()); yarnConfiguration.setInt(JAVA_RESERVED_MEMORY_MB, memoryOffHeap.intValue()); Integer cpu = cluster.getClusterConfig().getClusterSpec().getVirtualCoreCount(); if (cpu != null) { yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_CPU, cpu.intValue()); } Integer containerCount = cluster.getClusterConfig().getClusterSpec().getContainerCount(); if (containerCount != null) { yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_CONTAINER_COUNT, containerCount.intValue()); } String clusterName = cluster.getClusterConfig().getName(); if (clusterName != null) { yarnConfiguration.set(DacDaemonYarnApplication.YARN_APP_NAME, clusterName); } yarnConfiguration.set(YARN_CLUSTER_ID, cluster.getId().getId()); return rmAddress; } } | YarnService implements ProvisioningServiceDelegate { @VisibleForTesting protected String updateYarnConfiguration(Cluster cluster, YarnConfiguration yarnConfiguration) { String rmAddress = null; setYarnDefaults(cluster, yarnConfiguration); List<Property> keyValues = cluster.getClusterConfig().getSubPropertyList(); if ( keyValues != null && !keyValues.isEmpty()) { for (Property property : keyValues) { yarnConfiguration.set(property.getKey(), property.getValue()); if (RM_HOSTNAME.equalsIgnoreCase(property.getKey())) { rmAddress = property.getValue(); } } } String queue = cluster.getClusterConfig().getClusterSpec().getQueue(); if (queue != null && !queue.isEmpty()) { yarnConfiguration.set(DacDaemonYarnApplication.YARN_QUEUE_NAME, queue); } Integer memoryOnHeap = cluster.getClusterConfig().getClusterSpec().getMemoryMBOnHeap(); Integer memoryOffHeap = cluster.getClusterConfig().getClusterSpec().getMemoryMBOffHeap(); Preconditions.checkNotNull(memoryOnHeap, "Heap Memory is not specified"); Preconditions.checkNotNull(memoryOffHeap, "Direct Memory is not specified"); final int totalMemory = memoryOnHeap.intValue() + memoryOffHeap.intValue(); final double heapToDirectMemRatio = (double) (memoryOnHeap.intValue()) / totalMemory; yarnConfiguration.setDouble(HEAP_RESERVED_MIN_RATIO, Math.min(heapToDirectMemRatio, 0.1D)); yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_MEMORY_ON_HEAP, memoryOnHeap.intValue()); yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_MEMORY_OFF_HEAP, memoryOffHeap.intValue()); yarnConfiguration.setInt(JAVA_RESERVED_MEMORY_MB, memoryOffHeap.intValue()); Integer cpu = cluster.getClusterConfig().getClusterSpec().getVirtualCoreCount(); if (cpu != null) { yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_CPU, cpu.intValue()); } Integer containerCount = cluster.getClusterConfig().getClusterSpec().getContainerCount(); if (containerCount != null) { yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_CONTAINER_COUNT, containerCount.intValue()); } String clusterName = cluster.getClusterConfig().getName(); if (clusterName != null) { yarnConfiguration.set(DacDaemonYarnApplication.YARN_APP_NAME, clusterName); } yarnConfiguration.set(YARN_CLUSTER_ID, cluster.getId().getId()); return rmAddress; } YarnService(DremioConfig config, ProvisioningStateListener stateListener, NodeProvider executionNodeProvider,
OptionManager options, EditionProvider editionProvider); @VisibleForTesting YarnService(ProvisioningStateListener stateListener, YarnController controller, NodeProvider executionNodeProvider); } | YarnService implements ProvisioningServiceDelegate { @VisibleForTesting protected String updateYarnConfiguration(Cluster cluster, YarnConfiguration yarnConfiguration) { String rmAddress = null; setYarnDefaults(cluster, yarnConfiguration); List<Property> keyValues = cluster.getClusterConfig().getSubPropertyList(); if ( keyValues != null && !keyValues.isEmpty()) { for (Property property : keyValues) { yarnConfiguration.set(property.getKey(), property.getValue()); if (RM_HOSTNAME.equalsIgnoreCase(property.getKey())) { rmAddress = property.getValue(); } } } String queue = cluster.getClusterConfig().getClusterSpec().getQueue(); if (queue != null && !queue.isEmpty()) { yarnConfiguration.set(DacDaemonYarnApplication.YARN_QUEUE_NAME, queue); } Integer memoryOnHeap = cluster.getClusterConfig().getClusterSpec().getMemoryMBOnHeap(); Integer memoryOffHeap = cluster.getClusterConfig().getClusterSpec().getMemoryMBOffHeap(); Preconditions.checkNotNull(memoryOnHeap, "Heap Memory is not specified"); Preconditions.checkNotNull(memoryOffHeap, "Direct Memory is not specified"); final int totalMemory = memoryOnHeap.intValue() + memoryOffHeap.intValue(); final double heapToDirectMemRatio = (double) (memoryOnHeap.intValue()) / totalMemory; yarnConfiguration.setDouble(HEAP_RESERVED_MIN_RATIO, Math.min(heapToDirectMemRatio, 0.1D)); yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_MEMORY_ON_HEAP, memoryOnHeap.intValue()); yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_MEMORY_OFF_HEAP, memoryOffHeap.intValue()); yarnConfiguration.setInt(JAVA_RESERVED_MEMORY_MB, memoryOffHeap.intValue()); Integer cpu = cluster.getClusterConfig().getClusterSpec().getVirtualCoreCount(); if (cpu != null) { yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_CPU, cpu.intValue()); } Integer containerCount = cluster.getClusterConfig().getClusterSpec().getContainerCount(); if (containerCount != null) { yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_CONTAINER_COUNT, containerCount.intValue()); } String clusterName = cluster.getClusterConfig().getName(); if (clusterName != null) { yarnConfiguration.set(DacDaemonYarnApplication.YARN_APP_NAME, clusterName); } yarnConfiguration.set(YARN_CLUSTER_ID, cluster.getId().getId()); return rmAddress; } YarnService(DremioConfig config, ProvisioningStateListener stateListener, NodeProvider executionNodeProvider,
OptionManager options, EditionProvider editionProvider); @VisibleForTesting YarnService(ProvisioningStateListener stateListener, YarnController controller, NodeProvider executionNodeProvider); @Override ClusterType getType(); @Override ClusterEnriched startCluster(Cluster cluster); @Override void stopCluster(Cluster cluster); @Override ClusterEnriched resizeCluster(Cluster cluster); @Override ClusterEnriched getClusterInfo(final Cluster cluster); } | YarnService implements ProvisioningServiceDelegate { @VisibleForTesting protected String updateYarnConfiguration(Cluster cluster, YarnConfiguration yarnConfiguration) { String rmAddress = null; setYarnDefaults(cluster, yarnConfiguration); List<Property> keyValues = cluster.getClusterConfig().getSubPropertyList(); if ( keyValues != null && !keyValues.isEmpty()) { for (Property property : keyValues) { yarnConfiguration.set(property.getKey(), property.getValue()); if (RM_HOSTNAME.equalsIgnoreCase(property.getKey())) { rmAddress = property.getValue(); } } } String queue = cluster.getClusterConfig().getClusterSpec().getQueue(); if (queue != null && !queue.isEmpty()) { yarnConfiguration.set(DacDaemonYarnApplication.YARN_QUEUE_NAME, queue); } Integer memoryOnHeap = cluster.getClusterConfig().getClusterSpec().getMemoryMBOnHeap(); Integer memoryOffHeap = cluster.getClusterConfig().getClusterSpec().getMemoryMBOffHeap(); Preconditions.checkNotNull(memoryOnHeap, "Heap Memory is not specified"); Preconditions.checkNotNull(memoryOffHeap, "Direct Memory is not specified"); final int totalMemory = memoryOnHeap.intValue() + memoryOffHeap.intValue(); final double heapToDirectMemRatio = (double) (memoryOnHeap.intValue()) / totalMemory; yarnConfiguration.setDouble(HEAP_RESERVED_MIN_RATIO, Math.min(heapToDirectMemRatio, 0.1D)); yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_MEMORY_ON_HEAP, memoryOnHeap.intValue()); yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_MEMORY_OFF_HEAP, memoryOffHeap.intValue()); yarnConfiguration.setInt(JAVA_RESERVED_MEMORY_MB, memoryOffHeap.intValue()); Integer cpu = cluster.getClusterConfig().getClusterSpec().getVirtualCoreCount(); if (cpu != null) { yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_CPU, cpu.intValue()); } Integer containerCount = cluster.getClusterConfig().getClusterSpec().getContainerCount(); if (containerCount != null) { yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_CONTAINER_COUNT, containerCount.intValue()); } String clusterName = cluster.getClusterConfig().getName(); if (clusterName != null) { yarnConfiguration.set(DacDaemonYarnApplication.YARN_APP_NAME, clusterName); } yarnConfiguration.set(YARN_CLUSTER_ID, cluster.getId().getId()); return rmAddress; } YarnService(DremioConfig config, ProvisioningStateListener stateListener, NodeProvider executionNodeProvider,
OptionManager options, EditionProvider editionProvider); @VisibleForTesting YarnService(ProvisioningStateListener stateListener, YarnController controller, NodeProvider executionNodeProvider); @Override ClusterType getType(); @Override ClusterEnriched startCluster(Cluster cluster); @Override void stopCluster(Cluster cluster); @Override ClusterEnriched resizeCluster(Cluster cluster); @Override ClusterEnriched getClusterInfo(final Cluster cluster); } |
@Test public void testGetClusterInfo() throws Exception { assumeNonMaprProfile(); YarnController controller = Mockito.mock(YarnController.class); YarnService yarnService = new YarnService(new TestListener(), controller, Mockito.mock(NodeProvider.class)); Cluster cluster = new Cluster(); cluster.setState(ClusterState.CREATED); cluster.setStateChangeTime(System.currentTimeMillis()); cluster.setId(new ClusterId(UUID.randomUUID().toString())); ClusterConfig clusterConfig = new ClusterConfig(); clusterConfig.setClusterSpec(new ClusterSpec().setContainerCount(2).setMemoryMBOffHeap(4096).setMemoryMBOnHeap(4096).setVirtualCoreCount(2)); List<Property> propertyList = new ArrayList<>(); propertyList.add(new Property(FS_DEFAULT_NAME_KEY, "hdfs: propertyList.add(new Property(RM_HOSTNAME, "resource-manager")); propertyList.add(new Property(DremioConfig.DIST_WRITE_PATH_STRING, "pdfs: RunId runId = RunIds.generate(); clusterConfig.setSubPropertyList(propertyList); cluster.setClusterConfig(clusterConfig); cluster.setRunId(new com.dremio.provision.RunId(runId.toString())); YarnConfiguration yarnConfig = new YarnConfiguration(); yarnService.updateYarnConfiguration(cluster, yarnConfig); TwillController twillController = Mockito.mock(TwillController.class); ResourceReport resourceReport = Mockito.mock(ResourceReport.class); TwillRunnerService twillRunnerService = Mockito.mock(TwillRunnerService.class); List<TwillRunResources> resources = new ArrayList<>(); for (int i = 0; i < 10; i++) { resources.add(createResource(i)); } when(controller.startCluster(any(YarnConfiguration.class), eq(cluster.getClusterConfig().getSubPropertyList()))) .thenReturn(twillController); when(controller.getTwillService(cluster.getId())).thenReturn(twillRunnerService); when(twillController.getRunId()).thenReturn(runId); when(resourceReport.getRunnableResources(DacDaemonYarnApplication.YARN_RUNNABLE_NAME)).thenReturn(resources); when(twillRunnerService.lookup(DacDaemonYarnApplication.YARN_APPLICATION_NAME_DEFAULT, runId)).thenReturn(twillController); when(twillController.getResourceReport()).thenReturn(resourceReport); ClusterEnriched clusterEnriched = yarnService.getClusterInfo(cluster); assertNotNull(clusterEnriched.getRunTimeInfo()); assertEquals(8, clusterEnriched.getRunTimeInfo().getDecommissioningCount()); } | @Override public ClusterEnriched getClusterInfo(final Cluster cluster) throws YarnProvisioningHandlingException { TwillController controller = getTwillControllerHelper(cluster); final ClusterEnriched clusterEnriched = new ClusterEnriched(cluster); if (controller != null) { ResourceReport report = controller.getResourceReport(); if (report == null) { return clusterEnriched; } Collection<TwillRunResources> runResources = report.getRunnableResources(DacDaemonYarnApplication.YARN_RUNNABLE_NAME); Set<String> activeContainerIds = new HashSet<>(); for(NodeEndpoint ep : executionNodeProvider.getNodes()){ if(ep.hasProvisionId()){ activeContainerIds.add(ep.getProvisionId()); } } ImmutableContainers.Builder containers = Containers.builder(); List<Container> runningList = new ArrayList<>(); List<Container> disconnectedList = new ArrayList<>(); for (TwillRunResources runResource : runResources) { Container container = Container.builder() .setContainerId(runResource.getContainerId()) .setContainerPropertyList( ImmutableList.<Property>of( new Property("host", runResource.getHost()), new Property("memoryMB", "" + runResource.getMemoryMB()), new Property("virtualCoreCount", "" + runResource.getVirtualCores()) ) ) .build(); if(activeContainerIds.contains(runResource.getContainerId())) { runningList.add(container); } else { disconnectedList.add(container); } } int yarnDelta = (cluster.getClusterConfig().getClusterSpec().getContainerCount() - runResources.size()); if (yarnDelta > 0) { containers.setPendingCount(yarnDelta); } else if (yarnDelta < 0) { containers.setDecommissioningCount(Math.abs(yarnDelta)); } containers.setProvisioningCount(disconnectedList.size()); containers.setRunningList(runningList); containers.setDisconnectedList(disconnectedList); clusterEnriched.setRunTimeInfo(containers.build()); } return clusterEnriched; } | YarnService implements ProvisioningServiceDelegate { @Override public ClusterEnriched getClusterInfo(final Cluster cluster) throws YarnProvisioningHandlingException { TwillController controller = getTwillControllerHelper(cluster); final ClusterEnriched clusterEnriched = new ClusterEnriched(cluster); if (controller != null) { ResourceReport report = controller.getResourceReport(); if (report == null) { return clusterEnriched; } Collection<TwillRunResources> runResources = report.getRunnableResources(DacDaemonYarnApplication.YARN_RUNNABLE_NAME); Set<String> activeContainerIds = new HashSet<>(); for(NodeEndpoint ep : executionNodeProvider.getNodes()){ if(ep.hasProvisionId()){ activeContainerIds.add(ep.getProvisionId()); } } ImmutableContainers.Builder containers = Containers.builder(); List<Container> runningList = new ArrayList<>(); List<Container> disconnectedList = new ArrayList<>(); for (TwillRunResources runResource : runResources) { Container container = Container.builder() .setContainerId(runResource.getContainerId()) .setContainerPropertyList( ImmutableList.<Property>of( new Property("host", runResource.getHost()), new Property("memoryMB", "" + runResource.getMemoryMB()), new Property("virtualCoreCount", "" + runResource.getVirtualCores()) ) ) .build(); if(activeContainerIds.contains(runResource.getContainerId())) { runningList.add(container); } else { disconnectedList.add(container); } } int yarnDelta = (cluster.getClusterConfig().getClusterSpec().getContainerCount() - runResources.size()); if (yarnDelta > 0) { containers.setPendingCount(yarnDelta); } else if (yarnDelta < 0) { containers.setDecommissioningCount(Math.abs(yarnDelta)); } containers.setProvisioningCount(disconnectedList.size()); containers.setRunningList(runningList); containers.setDisconnectedList(disconnectedList); clusterEnriched.setRunTimeInfo(containers.build()); } return clusterEnriched; } } | YarnService implements ProvisioningServiceDelegate { @Override public ClusterEnriched getClusterInfo(final Cluster cluster) throws YarnProvisioningHandlingException { TwillController controller = getTwillControllerHelper(cluster); final ClusterEnriched clusterEnriched = new ClusterEnriched(cluster); if (controller != null) { ResourceReport report = controller.getResourceReport(); if (report == null) { return clusterEnriched; } Collection<TwillRunResources> runResources = report.getRunnableResources(DacDaemonYarnApplication.YARN_RUNNABLE_NAME); Set<String> activeContainerIds = new HashSet<>(); for(NodeEndpoint ep : executionNodeProvider.getNodes()){ if(ep.hasProvisionId()){ activeContainerIds.add(ep.getProvisionId()); } } ImmutableContainers.Builder containers = Containers.builder(); List<Container> runningList = new ArrayList<>(); List<Container> disconnectedList = new ArrayList<>(); for (TwillRunResources runResource : runResources) { Container container = Container.builder() .setContainerId(runResource.getContainerId()) .setContainerPropertyList( ImmutableList.<Property>of( new Property("host", runResource.getHost()), new Property("memoryMB", "" + runResource.getMemoryMB()), new Property("virtualCoreCount", "" + runResource.getVirtualCores()) ) ) .build(); if(activeContainerIds.contains(runResource.getContainerId())) { runningList.add(container); } else { disconnectedList.add(container); } } int yarnDelta = (cluster.getClusterConfig().getClusterSpec().getContainerCount() - runResources.size()); if (yarnDelta > 0) { containers.setPendingCount(yarnDelta); } else if (yarnDelta < 0) { containers.setDecommissioningCount(Math.abs(yarnDelta)); } containers.setProvisioningCount(disconnectedList.size()); containers.setRunningList(runningList); containers.setDisconnectedList(disconnectedList); clusterEnriched.setRunTimeInfo(containers.build()); } return clusterEnriched; } YarnService(DremioConfig config, ProvisioningStateListener stateListener, NodeProvider executionNodeProvider,
OptionManager options, EditionProvider editionProvider); @VisibleForTesting YarnService(ProvisioningStateListener stateListener, YarnController controller, NodeProvider executionNodeProvider); } | YarnService implements ProvisioningServiceDelegate { @Override public ClusterEnriched getClusterInfo(final Cluster cluster) throws YarnProvisioningHandlingException { TwillController controller = getTwillControllerHelper(cluster); final ClusterEnriched clusterEnriched = new ClusterEnriched(cluster); if (controller != null) { ResourceReport report = controller.getResourceReport(); if (report == null) { return clusterEnriched; } Collection<TwillRunResources> runResources = report.getRunnableResources(DacDaemonYarnApplication.YARN_RUNNABLE_NAME); Set<String> activeContainerIds = new HashSet<>(); for(NodeEndpoint ep : executionNodeProvider.getNodes()){ if(ep.hasProvisionId()){ activeContainerIds.add(ep.getProvisionId()); } } ImmutableContainers.Builder containers = Containers.builder(); List<Container> runningList = new ArrayList<>(); List<Container> disconnectedList = new ArrayList<>(); for (TwillRunResources runResource : runResources) { Container container = Container.builder() .setContainerId(runResource.getContainerId()) .setContainerPropertyList( ImmutableList.<Property>of( new Property("host", runResource.getHost()), new Property("memoryMB", "" + runResource.getMemoryMB()), new Property("virtualCoreCount", "" + runResource.getVirtualCores()) ) ) .build(); if(activeContainerIds.contains(runResource.getContainerId())) { runningList.add(container); } else { disconnectedList.add(container); } } int yarnDelta = (cluster.getClusterConfig().getClusterSpec().getContainerCount() - runResources.size()); if (yarnDelta > 0) { containers.setPendingCount(yarnDelta); } else if (yarnDelta < 0) { containers.setDecommissioningCount(Math.abs(yarnDelta)); } containers.setProvisioningCount(disconnectedList.size()); containers.setRunningList(runningList); containers.setDisconnectedList(disconnectedList); clusterEnriched.setRunTimeInfo(containers.build()); } return clusterEnriched; } YarnService(DremioConfig config, ProvisioningStateListener stateListener, NodeProvider executionNodeProvider,
OptionManager options, EditionProvider editionProvider); @VisibleForTesting YarnService(ProvisioningStateListener stateListener, YarnController controller, NodeProvider executionNodeProvider); @Override ClusterType getType(); @Override ClusterEnriched startCluster(Cluster cluster); @Override void stopCluster(Cluster cluster); @Override ClusterEnriched resizeCluster(Cluster cluster); @Override ClusterEnriched getClusterInfo(final Cluster cluster); } | YarnService implements ProvisioningServiceDelegate { @Override public ClusterEnriched getClusterInfo(final Cluster cluster) throws YarnProvisioningHandlingException { TwillController controller = getTwillControllerHelper(cluster); final ClusterEnriched clusterEnriched = new ClusterEnriched(cluster); if (controller != null) { ResourceReport report = controller.getResourceReport(); if (report == null) { return clusterEnriched; } Collection<TwillRunResources> runResources = report.getRunnableResources(DacDaemonYarnApplication.YARN_RUNNABLE_NAME); Set<String> activeContainerIds = new HashSet<>(); for(NodeEndpoint ep : executionNodeProvider.getNodes()){ if(ep.hasProvisionId()){ activeContainerIds.add(ep.getProvisionId()); } } ImmutableContainers.Builder containers = Containers.builder(); List<Container> runningList = new ArrayList<>(); List<Container> disconnectedList = new ArrayList<>(); for (TwillRunResources runResource : runResources) { Container container = Container.builder() .setContainerId(runResource.getContainerId()) .setContainerPropertyList( ImmutableList.<Property>of( new Property("host", runResource.getHost()), new Property("memoryMB", "" + runResource.getMemoryMB()), new Property("virtualCoreCount", "" + runResource.getVirtualCores()) ) ) .build(); if(activeContainerIds.contains(runResource.getContainerId())) { runningList.add(container); } else { disconnectedList.add(container); } } int yarnDelta = (cluster.getClusterConfig().getClusterSpec().getContainerCount() - runResources.size()); if (yarnDelta > 0) { containers.setPendingCount(yarnDelta); } else if (yarnDelta < 0) { containers.setDecommissioningCount(Math.abs(yarnDelta)); } containers.setProvisioningCount(disconnectedList.size()); containers.setRunningList(runningList); containers.setDisconnectedList(disconnectedList); clusterEnriched.setRunTimeInfo(containers.build()); } return clusterEnriched; } YarnService(DremioConfig config, ProvisioningStateListener stateListener, NodeProvider executionNodeProvider,
OptionManager options, EditionProvider editionProvider); @VisibleForTesting YarnService(ProvisioningStateListener stateListener, YarnController controller, NodeProvider executionNodeProvider); @Override ClusterType getType(); @Override ClusterEnriched startCluster(Cluster cluster); @Override void stopCluster(Cluster cluster); @Override ClusterEnriched resizeCluster(Cluster cluster); @Override ClusterEnriched getClusterInfo(final Cluster cluster); } |
@Test public void testTimelineServiceIsDisabledByDefault(){ YarnController controller = Mockito.mock(YarnController.class); YarnService yarnService = new YarnService(new TestListener(), controller, Mockito.mock(NodeProvider.class)); Cluster cluster = new Cluster(); cluster.setState(ClusterState.CREATED); cluster.setStateChangeTime(System.currentTimeMillis()); cluster.setId(new ClusterId(UUID.randomUUID().toString())); ClusterConfig clusterConfig = new ClusterConfig(); clusterConfig.setClusterSpec(new ClusterSpec().setContainerCount(2).setMemoryMBOffHeap(4096).setMemoryMBOnHeap(4096).setVirtualCoreCount(2)); List<Property> propertyList = new ArrayList<>(); clusterConfig.setSubPropertyList(propertyList); RunId runId = RunIds.generate(); cluster.setClusterConfig(clusterConfig); cluster.setRunId(new com.dremio.provision.RunId(runId.toString())); YarnConfiguration yarnConfig = new YarnConfiguration(); yarnConfig.setBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, true); yarnService.updateYarnConfiguration(cluster, yarnConfig); assertFalse(yarnConfig.getBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, true)); yarnConfig.setBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, false); cluster.getClusterConfig().getSubPropertyList().add(new Property(YarnConfiguration.TIMELINE_SERVICE_ENABLED, "true")); yarnService.updateYarnConfiguration(cluster, yarnConfig); assertTrue(yarnConfig.getBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, false)); } | @VisibleForTesting protected String updateYarnConfiguration(Cluster cluster, YarnConfiguration yarnConfiguration) { String rmAddress = null; setYarnDefaults(cluster, yarnConfiguration); List<Property> keyValues = cluster.getClusterConfig().getSubPropertyList(); if ( keyValues != null && !keyValues.isEmpty()) { for (Property property : keyValues) { yarnConfiguration.set(property.getKey(), property.getValue()); if (RM_HOSTNAME.equalsIgnoreCase(property.getKey())) { rmAddress = property.getValue(); } } } String queue = cluster.getClusterConfig().getClusterSpec().getQueue(); if (queue != null && !queue.isEmpty()) { yarnConfiguration.set(DacDaemonYarnApplication.YARN_QUEUE_NAME, queue); } Integer memoryOnHeap = cluster.getClusterConfig().getClusterSpec().getMemoryMBOnHeap(); Integer memoryOffHeap = cluster.getClusterConfig().getClusterSpec().getMemoryMBOffHeap(); Preconditions.checkNotNull(memoryOnHeap, "Heap Memory is not specified"); Preconditions.checkNotNull(memoryOffHeap, "Direct Memory is not specified"); final int totalMemory = memoryOnHeap.intValue() + memoryOffHeap.intValue(); final double heapToDirectMemRatio = (double) (memoryOnHeap.intValue()) / totalMemory; yarnConfiguration.setDouble(HEAP_RESERVED_MIN_RATIO, Math.min(heapToDirectMemRatio, 0.1D)); yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_MEMORY_ON_HEAP, memoryOnHeap.intValue()); yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_MEMORY_OFF_HEAP, memoryOffHeap.intValue()); yarnConfiguration.setInt(JAVA_RESERVED_MEMORY_MB, memoryOffHeap.intValue()); Integer cpu = cluster.getClusterConfig().getClusterSpec().getVirtualCoreCount(); if (cpu != null) { yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_CPU, cpu.intValue()); } Integer containerCount = cluster.getClusterConfig().getClusterSpec().getContainerCount(); if (containerCount != null) { yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_CONTAINER_COUNT, containerCount.intValue()); } String clusterName = cluster.getClusterConfig().getName(); if (clusterName != null) { yarnConfiguration.set(DacDaemonYarnApplication.YARN_APP_NAME, clusterName); } yarnConfiguration.set(YARN_CLUSTER_ID, cluster.getId().getId()); return rmAddress; } | YarnService implements ProvisioningServiceDelegate { @VisibleForTesting protected String updateYarnConfiguration(Cluster cluster, YarnConfiguration yarnConfiguration) { String rmAddress = null; setYarnDefaults(cluster, yarnConfiguration); List<Property> keyValues = cluster.getClusterConfig().getSubPropertyList(); if ( keyValues != null && !keyValues.isEmpty()) { for (Property property : keyValues) { yarnConfiguration.set(property.getKey(), property.getValue()); if (RM_HOSTNAME.equalsIgnoreCase(property.getKey())) { rmAddress = property.getValue(); } } } String queue = cluster.getClusterConfig().getClusterSpec().getQueue(); if (queue != null && !queue.isEmpty()) { yarnConfiguration.set(DacDaemonYarnApplication.YARN_QUEUE_NAME, queue); } Integer memoryOnHeap = cluster.getClusterConfig().getClusterSpec().getMemoryMBOnHeap(); Integer memoryOffHeap = cluster.getClusterConfig().getClusterSpec().getMemoryMBOffHeap(); Preconditions.checkNotNull(memoryOnHeap, "Heap Memory is not specified"); Preconditions.checkNotNull(memoryOffHeap, "Direct Memory is not specified"); final int totalMemory = memoryOnHeap.intValue() + memoryOffHeap.intValue(); final double heapToDirectMemRatio = (double) (memoryOnHeap.intValue()) / totalMemory; yarnConfiguration.setDouble(HEAP_RESERVED_MIN_RATIO, Math.min(heapToDirectMemRatio, 0.1D)); yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_MEMORY_ON_HEAP, memoryOnHeap.intValue()); yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_MEMORY_OFF_HEAP, memoryOffHeap.intValue()); yarnConfiguration.setInt(JAVA_RESERVED_MEMORY_MB, memoryOffHeap.intValue()); Integer cpu = cluster.getClusterConfig().getClusterSpec().getVirtualCoreCount(); if (cpu != null) { yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_CPU, cpu.intValue()); } Integer containerCount = cluster.getClusterConfig().getClusterSpec().getContainerCount(); if (containerCount != null) { yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_CONTAINER_COUNT, containerCount.intValue()); } String clusterName = cluster.getClusterConfig().getName(); if (clusterName != null) { yarnConfiguration.set(DacDaemonYarnApplication.YARN_APP_NAME, clusterName); } yarnConfiguration.set(YARN_CLUSTER_ID, cluster.getId().getId()); return rmAddress; } } | YarnService implements ProvisioningServiceDelegate { @VisibleForTesting protected String updateYarnConfiguration(Cluster cluster, YarnConfiguration yarnConfiguration) { String rmAddress = null; setYarnDefaults(cluster, yarnConfiguration); List<Property> keyValues = cluster.getClusterConfig().getSubPropertyList(); if ( keyValues != null && !keyValues.isEmpty()) { for (Property property : keyValues) { yarnConfiguration.set(property.getKey(), property.getValue()); if (RM_HOSTNAME.equalsIgnoreCase(property.getKey())) { rmAddress = property.getValue(); } } } String queue = cluster.getClusterConfig().getClusterSpec().getQueue(); if (queue != null && !queue.isEmpty()) { yarnConfiguration.set(DacDaemonYarnApplication.YARN_QUEUE_NAME, queue); } Integer memoryOnHeap = cluster.getClusterConfig().getClusterSpec().getMemoryMBOnHeap(); Integer memoryOffHeap = cluster.getClusterConfig().getClusterSpec().getMemoryMBOffHeap(); Preconditions.checkNotNull(memoryOnHeap, "Heap Memory is not specified"); Preconditions.checkNotNull(memoryOffHeap, "Direct Memory is not specified"); final int totalMemory = memoryOnHeap.intValue() + memoryOffHeap.intValue(); final double heapToDirectMemRatio = (double) (memoryOnHeap.intValue()) / totalMemory; yarnConfiguration.setDouble(HEAP_RESERVED_MIN_RATIO, Math.min(heapToDirectMemRatio, 0.1D)); yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_MEMORY_ON_HEAP, memoryOnHeap.intValue()); yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_MEMORY_OFF_HEAP, memoryOffHeap.intValue()); yarnConfiguration.setInt(JAVA_RESERVED_MEMORY_MB, memoryOffHeap.intValue()); Integer cpu = cluster.getClusterConfig().getClusterSpec().getVirtualCoreCount(); if (cpu != null) { yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_CPU, cpu.intValue()); } Integer containerCount = cluster.getClusterConfig().getClusterSpec().getContainerCount(); if (containerCount != null) { yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_CONTAINER_COUNT, containerCount.intValue()); } String clusterName = cluster.getClusterConfig().getName(); if (clusterName != null) { yarnConfiguration.set(DacDaemonYarnApplication.YARN_APP_NAME, clusterName); } yarnConfiguration.set(YARN_CLUSTER_ID, cluster.getId().getId()); return rmAddress; } YarnService(DremioConfig config, ProvisioningStateListener stateListener, NodeProvider executionNodeProvider,
OptionManager options, EditionProvider editionProvider); @VisibleForTesting YarnService(ProvisioningStateListener stateListener, YarnController controller, NodeProvider executionNodeProvider); } | YarnService implements ProvisioningServiceDelegate { @VisibleForTesting protected String updateYarnConfiguration(Cluster cluster, YarnConfiguration yarnConfiguration) { String rmAddress = null; setYarnDefaults(cluster, yarnConfiguration); List<Property> keyValues = cluster.getClusterConfig().getSubPropertyList(); if ( keyValues != null && !keyValues.isEmpty()) { for (Property property : keyValues) { yarnConfiguration.set(property.getKey(), property.getValue()); if (RM_HOSTNAME.equalsIgnoreCase(property.getKey())) { rmAddress = property.getValue(); } } } String queue = cluster.getClusterConfig().getClusterSpec().getQueue(); if (queue != null && !queue.isEmpty()) { yarnConfiguration.set(DacDaemonYarnApplication.YARN_QUEUE_NAME, queue); } Integer memoryOnHeap = cluster.getClusterConfig().getClusterSpec().getMemoryMBOnHeap(); Integer memoryOffHeap = cluster.getClusterConfig().getClusterSpec().getMemoryMBOffHeap(); Preconditions.checkNotNull(memoryOnHeap, "Heap Memory is not specified"); Preconditions.checkNotNull(memoryOffHeap, "Direct Memory is not specified"); final int totalMemory = memoryOnHeap.intValue() + memoryOffHeap.intValue(); final double heapToDirectMemRatio = (double) (memoryOnHeap.intValue()) / totalMemory; yarnConfiguration.setDouble(HEAP_RESERVED_MIN_RATIO, Math.min(heapToDirectMemRatio, 0.1D)); yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_MEMORY_ON_HEAP, memoryOnHeap.intValue()); yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_MEMORY_OFF_HEAP, memoryOffHeap.intValue()); yarnConfiguration.setInt(JAVA_RESERVED_MEMORY_MB, memoryOffHeap.intValue()); Integer cpu = cluster.getClusterConfig().getClusterSpec().getVirtualCoreCount(); if (cpu != null) { yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_CPU, cpu.intValue()); } Integer containerCount = cluster.getClusterConfig().getClusterSpec().getContainerCount(); if (containerCount != null) { yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_CONTAINER_COUNT, containerCount.intValue()); } String clusterName = cluster.getClusterConfig().getName(); if (clusterName != null) { yarnConfiguration.set(DacDaemonYarnApplication.YARN_APP_NAME, clusterName); } yarnConfiguration.set(YARN_CLUSTER_ID, cluster.getId().getId()); return rmAddress; } YarnService(DremioConfig config, ProvisioningStateListener stateListener, NodeProvider executionNodeProvider,
OptionManager options, EditionProvider editionProvider); @VisibleForTesting YarnService(ProvisioningStateListener stateListener, YarnController controller, NodeProvider executionNodeProvider); @Override ClusterType getType(); @Override ClusterEnriched startCluster(Cluster cluster); @Override void stopCluster(Cluster cluster); @Override ClusterEnriched resizeCluster(Cluster cluster); @Override ClusterEnriched getClusterInfo(final Cluster cluster); } | YarnService implements ProvisioningServiceDelegate { @VisibleForTesting protected String updateYarnConfiguration(Cluster cluster, YarnConfiguration yarnConfiguration) { String rmAddress = null; setYarnDefaults(cluster, yarnConfiguration); List<Property> keyValues = cluster.getClusterConfig().getSubPropertyList(); if ( keyValues != null && !keyValues.isEmpty()) { for (Property property : keyValues) { yarnConfiguration.set(property.getKey(), property.getValue()); if (RM_HOSTNAME.equalsIgnoreCase(property.getKey())) { rmAddress = property.getValue(); } } } String queue = cluster.getClusterConfig().getClusterSpec().getQueue(); if (queue != null && !queue.isEmpty()) { yarnConfiguration.set(DacDaemonYarnApplication.YARN_QUEUE_NAME, queue); } Integer memoryOnHeap = cluster.getClusterConfig().getClusterSpec().getMemoryMBOnHeap(); Integer memoryOffHeap = cluster.getClusterConfig().getClusterSpec().getMemoryMBOffHeap(); Preconditions.checkNotNull(memoryOnHeap, "Heap Memory is not specified"); Preconditions.checkNotNull(memoryOffHeap, "Direct Memory is not specified"); final int totalMemory = memoryOnHeap.intValue() + memoryOffHeap.intValue(); final double heapToDirectMemRatio = (double) (memoryOnHeap.intValue()) / totalMemory; yarnConfiguration.setDouble(HEAP_RESERVED_MIN_RATIO, Math.min(heapToDirectMemRatio, 0.1D)); yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_MEMORY_ON_HEAP, memoryOnHeap.intValue()); yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_MEMORY_OFF_HEAP, memoryOffHeap.intValue()); yarnConfiguration.setInt(JAVA_RESERVED_MEMORY_MB, memoryOffHeap.intValue()); Integer cpu = cluster.getClusterConfig().getClusterSpec().getVirtualCoreCount(); if (cpu != null) { yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_CPU, cpu.intValue()); } Integer containerCount = cluster.getClusterConfig().getClusterSpec().getContainerCount(); if (containerCount != null) { yarnConfiguration.setInt(DacDaemonYarnApplication.YARN_CONTAINER_COUNT, containerCount.intValue()); } String clusterName = cluster.getClusterConfig().getName(); if (clusterName != null) { yarnConfiguration.set(DacDaemonYarnApplication.YARN_APP_NAME, clusterName); } yarnConfiguration.set(YARN_CLUSTER_ID, cluster.getId().getId()); return rmAddress; } YarnService(DremioConfig config, ProvisioningStateListener stateListener, NodeProvider executionNodeProvider,
OptionManager options, EditionProvider editionProvider); @VisibleForTesting YarnService(ProvisioningStateListener stateListener, YarnController controller, NodeProvider executionNodeProvider); @Override ClusterType getType(); @Override ClusterEnriched startCluster(Cluster cluster); @Override void stopCluster(Cluster cluster); @Override ClusterEnriched resizeCluster(Cluster cluster); @Override ClusterEnriched getClusterInfo(final Cluster cluster); } |
@Test public void testToPathStream() throws MalformedURLException, IOException { try ( URLClassLoader clA = new URLClassLoader( new URL[] { new URL("file:/foo/bar.jar"), new URL("file:/foo/baz.jar") }, null); URLClassLoader clB = new URLClassLoader( new URL[] { new URL("file:/test/ab.jar"), new URL("file:/test/cd.jar") }, clA)) { Stream<Path> stream = AppBundleGenerator.toPathStream(clB); assertThat(stream.collect(Collectors.toList()), is(equalTo(Arrays.asList(Paths.get("/foo/bar.jar"), Paths.get("/foo/baz.jar"), Paths.get("/test/ab.jar"), Paths.get("/test/cd.jar"))))); } } | @VisibleForTesting static Stream<Path> toPathStream(ClassLoader classLoader) { if (classLoader == null) { return Stream.of(); } if (classLoader != ClassLoader.getSystemClassLoader()) { return Stream.concat(toPathStream(classLoader.getParent()), getPaths(classLoader)); } else { return getPaths(classLoader); } } | AppBundleGenerator { @VisibleForTesting static Stream<Path> toPathStream(ClassLoader classLoader) { if (classLoader == null) { return Stream.of(); } if (classLoader != ClassLoader.getSystemClassLoader()) { return Stream.concat(toPathStream(classLoader.getParent()), getPaths(classLoader)); } else { return getPaths(classLoader); } } } | AppBundleGenerator { @VisibleForTesting static Stream<Path> toPathStream(ClassLoader classLoader) { if (classLoader == null) { return Stream.of(); } if (classLoader != ClassLoader.getSystemClassLoader()) { return Stream.concat(toPathStream(classLoader.getParent()), getPaths(classLoader)); } else { return getPaths(classLoader); } } AppBundleGenerator(ClassLoader classLoader,
@NotNull List<String> classPathPrefix,
@NotNull List<String> classPath,
List<String> nativeLibraryPath,
Path pluginsPath); } | AppBundleGenerator { @VisibleForTesting static Stream<Path> toPathStream(ClassLoader classLoader) { if (classLoader == null) { return Stream.of(); } if (classLoader != ClassLoader.getSystemClassLoader()) { return Stream.concat(toPathStream(classLoader.getParent()), getPaths(classLoader)); } else { return getPaths(classLoader); } } AppBundleGenerator(ClassLoader classLoader,
@NotNull List<String> classPathPrefix,
@NotNull List<String> classPath,
List<String> nativeLibraryPath,
Path pluginsPath); static AppBundleGenerator of(DremioConfig config); Path generateBundle(); } | AppBundleGenerator { @VisibleForTesting static Stream<Path> toPathStream(ClassLoader classLoader) { if (classLoader == null) { return Stream.of(); } if (classLoader != ClassLoader.getSystemClassLoader()) { return Stream.concat(toPathStream(classLoader.getParent()), getPaths(classLoader)); } else { return getPaths(classLoader); } } AppBundleGenerator(ClassLoader classLoader,
@NotNull List<String> classPathPrefix,
@NotNull List<String> classPath,
List<String> nativeLibraryPath,
Path pluginsPath); static AppBundleGenerator of(DremioConfig config); Path generateBundle(); static final String X_DREMIO_LIBRARY_PATH_MANIFEST_ATTRIBUTE; static final String X_DREMIO_PLUGINS_PATH_MANIFEST_ATTRIBUTE; } |
@Test public void testSkipJDKClassLoaders() throws MalformedURLException, IOException { ClassLoader classLoader = ClassLoader.getSystemClassLoader(); ClassLoader parent = classLoader.getParent(); Assume.assumeNotNull(parent); Assume.assumeTrue(parent instanceof URLClassLoader); URL[] parentURLs = ((URLClassLoader) parent).getURLs(); Stream<Path> stream = AppBundleGenerator.toPathStream(classLoader); assertFalse("Stream contains a jar from the parent classloader", stream.anyMatch(path -> { try { return Arrays.asList(parentURLs).contains(path.toUri().toURL()); } catch (MalformedURLException e) { throw new IllegalArgumentException(e); } })); } | @VisibleForTesting static Stream<Path> toPathStream(ClassLoader classLoader) { if (classLoader == null) { return Stream.of(); } if (classLoader != ClassLoader.getSystemClassLoader()) { return Stream.concat(toPathStream(classLoader.getParent()), getPaths(classLoader)); } else { return getPaths(classLoader); } } | AppBundleGenerator { @VisibleForTesting static Stream<Path> toPathStream(ClassLoader classLoader) { if (classLoader == null) { return Stream.of(); } if (classLoader != ClassLoader.getSystemClassLoader()) { return Stream.concat(toPathStream(classLoader.getParent()), getPaths(classLoader)); } else { return getPaths(classLoader); } } } | AppBundleGenerator { @VisibleForTesting static Stream<Path> toPathStream(ClassLoader classLoader) { if (classLoader == null) { return Stream.of(); } if (classLoader != ClassLoader.getSystemClassLoader()) { return Stream.concat(toPathStream(classLoader.getParent()), getPaths(classLoader)); } else { return getPaths(classLoader); } } AppBundleGenerator(ClassLoader classLoader,
@NotNull List<String> classPathPrefix,
@NotNull List<String> classPath,
List<String> nativeLibraryPath,
Path pluginsPath); } | AppBundleGenerator { @VisibleForTesting static Stream<Path> toPathStream(ClassLoader classLoader) { if (classLoader == null) { return Stream.of(); } if (classLoader != ClassLoader.getSystemClassLoader()) { return Stream.concat(toPathStream(classLoader.getParent()), getPaths(classLoader)); } else { return getPaths(classLoader); } } AppBundleGenerator(ClassLoader classLoader,
@NotNull List<String> classPathPrefix,
@NotNull List<String> classPath,
List<String> nativeLibraryPath,
Path pluginsPath); static AppBundleGenerator of(DremioConfig config); Path generateBundle(); } | AppBundleGenerator { @VisibleForTesting static Stream<Path> toPathStream(ClassLoader classLoader) { if (classLoader == null) { return Stream.of(); } if (classLoader != ClassLoader.getSystemClassLoader()) { return Stream.concat(toPathStream(classLoader.getParent()), getPaths(classLoader)); } else { return getPaths(classLoader); } } AppBundleGenerator(ClassLoader classLoader,
@NotNull List<String> classPathPrefix,
@NotNull List<String> classPath,
List<String> nativeLibraryPath,
Path pluginsPath); static AppBundleGenerator of(DremioConfig config); Path generateBundle(); static final String X_DREMIO_LIBRARY_PATH_MANIFEST_ATTRIBUTE; static final String X_DREMIO_PLUGINS_PATH_MANIFEST_ATTRIBUTE; } |
@Test public void exampleGeneratorQuery() { String outputQuery1 = cardGenerator.generateCardGenQuery("col.with.dots", "TABLE(\"jobstore\".\"path\"(type => 'arrow))", rules); String expQuery1 = "SELECT\n" + "match_pattern_example(dremio_preview_data.\"col.with.dots\", 'CONTAINS', 'test pattern', false) AS example_0,\n" + "match_pattern_example(dremio_preview_data.\"col.with.dots\", 'MATCHES', '.*txt.*', true) AS example_1,\n" + "dremio_preview_data.\"col.with.dots\" AS inputCol\n" + "FROM TABLE(\"jobstore\".\"path\"(type => 'arrow)) as dremio_preview_data\n" + "WHERE \"col.with.dots\" IS NOT NULL\n" + "LIMIT 3"; assertEquals(expQuery1, outputQuery1); String outputQuery2 = cardGenerator.generateCardGenQuery("normalCol", "TABLE(\"jobstore\".\"path\"(type => 'arrow))", rules); String expQuery2 = "SELECT\n" + "match_pattern_example(dremio_preview_data.normalCol, 'CONTAINS', 'test pattern', false) AS example_0,\n" + "match_pattern_example(dremio_preview_data.normalCol, 'MATCHES', '.*txt.*', true) AS example_1,\n" + "dremio_preview_data.normalCol AS inputCol\n" + "FROM TABLE(\"jobstore\".\"path\"(type => 'arrow)) as dremio_preview_data\n" + "WHERE normalCol IS NOT NULL\n" + "LIMIT 3"; assertEquals(expQuery2, outputQuery2); } | <T> String generateCardGenQuery(String inputColName, String datasetPreviewTable, List<TransformRuleWrapper<T>> evaluators) { StringBuilder queryBuilder = new StringBuilder(); String inputExpr = String.format("%s.%s", quoteIdentifier("dremio_preview_data"), quoteIdentifier(inputColName)); List<String> exprs = Lists.newArrayList(); for(int i=0; i<evaluators.size(); i++) { if (evaluators.get(i).canGenerateExamples()) { final String expr = evaluators.get(i).getExampleFunctionExpr(inputExpr); final String outputColAlias = "example_" + i; exprs.add(String.format("%s AS %s", expr, outputColAlias)); } } exprs.add(String.format("%s AS inputCol", inputExpr)); queryBuilder.append("SELECT\n"); queryBuilder.append(Joiner.on(",\n").join(exprs)); queryBuilder.append(format("\nFROM %s as dremio_preview_data", datasetPreviewTable)); queryBuilder.append(format("\nWHERE %s IS NOT NULL", quoteIdentifier(inputColName))); queryBuilder.append(format("\nLIMIT %d", Card.EXAMPLES_TO_SHOW)); return queryBuilder.toString(); } | CardGenerator { <T> String generateCardGenQuery(String inputColName, String datasetPreviewTable, List<TransformRuleWrapper<T>> evaluators) { StringBuilder queryBuilder = new StringBuilder(); String inputExpr = String.format("%s.%s", quoteIdentifier("dremio_preview_data"), quoteIdentifier(inputColName)); List<String> exprs = Lists.newArrayList(); for(int i=0; i<evaluators.size(); i++) { if (evaluators.get(i).canGenerateExamples()) { final String expr = evaluators.get(i).getExampleFunctionExpr(inputExpr); final String outputColAlias = "example_" + i; exprs.add(String.format("%s AS %s", expr, outputColAlias)); } } exprs.add(String.format("%s AS inputCol", inputExpr)); queryBuilder.append("SELECT\n"); queryBuilder.append(Joiner.on(",\n").join(exprs)); queryBuilder.append(format("\nFROM %s as dremio_preview_data", datasetPreviewTable)); queryBuilder.append(format("\nWHERE %s IS NOT NULL", quoteIdentifier(inputColName))); queryBuilder.append(format("\nLIMIT %d", Card.EXAMPLES_TO_SHOW)); return queryBuilder.toString(); } } | CardGenerator { <T> String generateCardGenQuery(String inputColName, String datasetPreviewTable, List<TransformRuleWrapper<T>> evaluators) { StringBuilder queryBuilder = new StringBuilder(); String inputExpr = String.format("%s.%s", quoteIdentifier("dremio_preview_data"), quoteIdentifier(inputColName)); List<String> exprs = Lists.newArrayList(); for(int i=0; i<evaluators.size(); i++) { if (evaluators.get(i).canGenerateExamples()) { final String expr = evaluators.get(i).getExampleFunctionExpr(inputExpr); final String outputColAlias = "example_" + i; exprs.add(String.format("%s AS %s", expr, outputColAlias)); } } exprs.add(String.format("%s AS inputCol", inputExpr)); queryBuilder.append("SELECT\n"); queryBuilder.append(Joiner.on(",\n").join(exprs)); queryBuilder.append(format("\nFROM %s as dremio_preview_data", datasetPreviewTable)); queryBuilder.append(format("\nWHERE %s IS NOT NULL", quoteIdentifier(inputColName))); queryBuilder.append(format("\nLIMIT %d", Card.EXAMPLES_TO_SHOW)); return queryBuilder.toString(); } CardGenerator(final QueryExecutor executor, DatasetPath datasetPath, DatasetVersion version); } | CardGenerator { <T> String generateCardGenQuery(String inputColName, String datasetPreviewTable, List<TransformRuleWrapper<T>> evaluators) { StringBuilder queryBuilder = new StringBuilder(); String inputExpr = String.format("%s.%s", quoteIdentifier("dremio_preview_data"), quoteIdentifier(inputColName)); List<String> exprs = Lists.newArrayList(); for(int i=0; i<evaluators.size(); i++) { if (evaluators.get(i).canGenerateExamples()) { final String expr = evaluators.get(i).getExampleFunctionExpr(inputExpr); final String outputColAlias = "example_" + i; exprs.add(String.format("%s AS %s", expr, outputColAlias)); } } exprs.add(String.format("%s AS inputCol", inputExpr)); queryBuilder.append("SELECT\n"); queryBuilder.append(Joiner.on(",\n").join(exprs)); queryBuilder.append(format("\nFROM %s as dremio_preview_data", datasetPreviewTable)); queryBuilder.append(format("\nWHERE %s IS NOT NULL", quoteIdentifier(inputColName))); queryBuilder.append(format("\nLIMIT %d", Card.EXAMPLES_TO_SHOW)); return queryBuilder.toString(); } CardGenerator(final QueryExecutor executor, DatasetPath datasetPath, DatasetVersion version); List<Card<T>> generateCards(SqlQuery datasetSql, String colName,
List<TransformRuleWrapper<T>> transformRuleWrappers, Comparator<Card<T>> comparator, BufferAllocator allocator); } | CardGenerator { <T> String generateCardGenQuery(String inputColName, String datasetPreviewTable, List<TransformRuleWrapper<T>> evaluators) { StringBuilder queryBuilder = new StringBuilder(); String inputExpr = String.format("%s.%s", quoteIdentifier("dremio_preview_data"), quoteIdentifier(inputColName)); List<String> exprs = Lists.newArrayList(); for(int i=0; i<evaluators.size(); i++) { if (evaluators.get(i).canGenerateExamples()) { final String expr = evaluators.get(i).getExampleFunctionExpr(inputExpr); final String outputColAlias = "example_" + i; exprs.add(String.format("%s AS %s", expr, outputColAlias)); } } exprs.add(String.format("%s AS inputCol", inputExpr)); queryBuilder.append("SELECT\n"); queryBuilder.append(Joiner.on(",\n").join(exprs)); queryBuilder.append(format("\nFROM %s as dremio_preview_data", datasetPreviewTable)); queryBuilder.append(format("\nWHERE %s IS NOT NULL", quoteIdentifier(inputColName))); queryBuilder.append(format("\nLIMIT %d", Card.EXAMPLES_TO_SHOW)); return queryBuilder.toString(); } CardGenerator(final QueryExecutor executor, DatasetPath datasetPath, DatasetVersion version); List<Card<T>> generateCards(SqlQuery datasetSql, String colName,
List<TransformRuleWrapper<T>> transformRuleWrappers, Comparator<Card<T>> comparator, BufferAllocator allocator); } |
@Test public void testToPathStreamFromClassPath() throws MalformedURLException, IOException { Path mainFolder = temporaryFolder.newFolder().toPath(); Files.createFile(mainFolder.resolve("a.jar")); Files.createFile(mainFolder.resolve("b.jar")); Files.createFile(mainFolder.resolve("xyz-dremio.jar")); Files.createDirectory(mainFolder.resolve("www-dremio")); Files.createFile(mainFolder.resolve("www-dremio/foo.jar")); assertThat( AppBundleGenerator .toPathStream( Arrays.asList(mainFolder.resolve("a.jar").toString(), mainFolder.resolve(".*-dremio").toString())) .collect(Collectors.toList()), is(equalTo(Arrays.asList(mainFolder.resolve("a.jar"), mainFolder.resolve("www-dremio"))))); } | @VisibleForTesting static Stream<Path> toPathStream(ClassLoader classLoader) { if (classLoader == null) { return Stream.of(); } if (classLoader != ClassLoader.getSystemClassLoader()) { return Stream.concat(toPathStream(classLoader.getParent()), getPaths(classLoader)); } else { return getPaths(classLoader); } } | AppBundleGenerator { @VisibleForTesting static Stream<Path> toPathStream(ClassLoader classLoader) { if (classLoader == null) { return Stream.of(); } if (classLoader != ClassLoader.getSystemClassLoader()) { return Stream.concat(toPathStream(classLoader.getParent()), getPaths(classLoader)); } else { return getPaths(classLoader); } } } | AppBundleGenerator { @VisibleForTesting static Stream<Path> toPathStream(ClassLoader classLoader) { if (classLoader == null) { return Stream.of(); } if (classLoader != ClassLoader.getSystemClassLoader()) { return Stream.concat(toPathStream(classLoader.getParent()), getPaths(classLoader)); } else { return getPaths(classLoader); } } AppBundleGenerator(ClassLoader classLoader,
@NotNull List<String> classPathPrefix,
@NotNull List<String> classPath,
List<String> nativeLibraryPath,
Path pluginsPath); } | AppBundleGenerator { @VisibleForTesting static Stream<Path> toPathStream(ClassLoader classLoader) { if (classLoader == null) { return Stream.of(); } if (classLoader != ClassLoader.getSystemClassLoader()) { return Stream.concat(toPathStream(classLoader.getParent()), getPaths(classLoader)); } else { return getPaths(classLoader); } } AppBundleGenerator(ClassLoader classLoader,
@NotNull List<String> classPathPrefix,
@NotNull List<String> classPath,
List<String> nativeLibraryPath,
Path pluginsPath); static AppBundleGenerator of(DremioConfig config); Path generateBundle(); } | AppBundleGenerator { @VisibleForTesting static Stream<Path> toPathStream(ClassLoader classLoader) { if (classLoader == null) { return Stream.of(); } if (classLoader != ClassLoader.getSystemClassLoader()) { return Stream.concat(toPathStream(classLoader.getParent()), getPaths(classLoader)); } else { return getPaths(classLoader); } } AppBundleGenerator(ClassLoader classLoader,
@NotNull List<String> classPathPrefix,
@NotNull List<String> classPath,
List<String> nativeLibraryPath,
Path pluginsPath); static AppBundleGenerator of(DremioConfig config); Path generateBundle(); static final String X_DREMIO_LIBRARY_PATH_MANIFEST_ATTRIBUTE; static final String X_DREMIO_PLUGINS_PATH_MANIFEST_ATTRIBUTE; } |
@Test public void testUnavailableContainer() throws Exception { when(connection.getResponseCode()).thenReturn(HttpStatus.SC_NOT_FOUND); assertNull(healthMonitorThread.getContainerState(connection)); assertFalse(healthMonitorThread.isHealthy()); } | @Override public boolean isHealthy() { return isHealthy; } | YarnContainerHealthMonitor implements LiveHealthMonitor { @Override public boolean isHealthy() { return isHealthy; } } | YarnContainerHealthMonitor implements LiveHealthMonitor { @Override public boolean isHealthy() { return isHealthy; } YarnContainerHealthMonitor(); } | YarnContainerHealthMonitor implements LiveHealthMonitor { @Override public boolean isHealthy() { return isHealthy; } YarnContainerHealthMonitor(); @Override boolean isHealthy(); } | YarnContainerHealthMonitor implements LiveHealthMonitor { @Override public boolean isHealthy() { return isHealthy; } YarnContainerHealthMonitor(); @Override boolean isHealthy(); } |
@Test public void testHealthyContainer() throws Exception { String containerInfoJson = "{\"container\":{\"user\":\"dremio\",\"state\":\"NEW\"}}"; InputStream targetStream = new ByteArrayInputStream(containerInfoJson.getBytes()); when(connection.getInputStream()).thenReturn(targetStream); assertEquals(ContainerState.NEW.name(), healthMonitorThread.getContainerState(connection)); assertTrue(healthMonitorThread.isHealthy()); } | @Override public boolean isHealthy() { return isHealthy; } | YarnContainerHealthMonitor implements LiveHealthMonitor { @Override public boolean isHealthy() { return isHealthy; } } | YarnContainerHealthMonitor implements LiveHealthMonitor { @Override public boolean isHealthy() { return isHealthy; } YarnContainerHealthMonitor(); } | YarnContainerHealthMonitor implements LiveHealthMonitor { @Override public boolean isHealthy() { return isHealthy; } YarnContainerHealthMonitor(); @Override boolean isHealthy(); } | YarnContainerHealthMonitor implements LiveHealthMonitor { @Override public boolean isHealthy() { return isHealthy; } YarnContainerHealthMonitor(); @Override boolean isHealthy(); } |
@Test public void testUnhealthyContainer() throws Exception { String containerInfoJson = "{\"container\":{\"state\":\"COMPLETE\",\"user\":\"root\"}}"; InputStream targetStream = new ByteArrayInputStream(containerInfoJson.getBytes()); when(connection.getInputStream()).thenReturn(targetStream); assertEquals(ContainerState.COMPLETE.name(), healthMonitorThread.getContainerState(connection)); assertFalse(healthMonitorThread.isHealthy()); } | @Override public boolean isHealthy() { return isHealthy; } | YarnContainerHealthMonitor implements LiveHealthMonitor { @Override public boolean isHealthy() { return isHealthy; } } | YarnContainerHealthMonitor implements LiveHealthMonitor { @Override public boolean isHealthy() { return isHealthy; } YarnContainerHealthMonitor(); } | YarnContainerHealthMonitor implements LiveHealthMonitor { @Override public boolean isHealthy() { return isHealthy; } YarnContainerHealthMonitor(); @Override boolean isHealthy(); } | YarnContainerHealthMonitor implements LiveHealthMonitor { @Override public boolean isHealthy() { return isHealthy; } YarnContainerHealthMonitor(); @Override boolean isHealthy(); } |
@Test public void matchCountGeneratorQuery() { String outputQuery1 = cardGenerator.generateMatchCountQuery("col with spaces", "TABLE(\"jobstore\".\"path\"(type => 'arrow))", rules); String expQuery1 = "SELECT\n" + "sum(CASE WHEN regexp_like(dremio_preview_data.\"col with spaces\", '.*?\\Qtest pattern\\E.*?') THEN 1 ELSE 0 END) AS matched_count_0,\n" + "sum(CASE WHEN regexp_like(dremio_preview_data.\"col with spaces\", '(?i)(?u).*?.*txt.*.*?') THEN 1 ELSE 0 END) AS matched_count_1,\n" + "COUNT(1) as total\n" + "FROM TABLE(\"jobstore\".\"path\"(type => 'arrow)) as dremio_preview_data"; assertEquals(expQuery1, outputQuery1); String outputQuery2 = cardGenerator.generateMatchCountQuery("normalCol", "TABLE(\"jobstore\".\"path\"(type => 'arrow))", rules); String expQuery2 = "SELECT\n" + "sum(CASE WHEN regexp_like(dremio_preview_data.normalCol, '.*?\\Qtest pattern\\E.*?') THEN 1 ELSE 0 END) AS matched_count_0,\n" + "sum(CASE WHEN regexp_like(dremio_preview_data.normalCol, '(?i)(?u).*?.*txt.*.*?') THEN 1 ELSE 0 END) AS matched_count_1,\n" + "COUNT(1) as total\n" + "FROM TABLE(\"jobstore\".\"path\"(type => 'arrow)) as dremio_preview_data"; assertEquals(expQuery2, outputQuery2); } | <T> String generateMatchCountQuery(String inputColName, String datasetPreviewTable, List<TransformRuleWrapper<T>> evaluators) { StringBuilder queryBuilder = new StringBuilder(); String inputExpr = String.format("%s.%s", quoteIdentifier("dremio_preview_data"), quoteIdentifier(inputColName)); List<String> exprs = Lists.newArrayList(); for(int i=0; i<evaluators.size(); i++) { final String expr = evaluators.get(i).getMatchFunctionExpr(inputExpr); final String outputColAlias = "matched_count_" + i; exprs.add(String.format("sum(CASE WHEN %s THEN 1 ELSE 0 END) AS %s", expr, outputColAlias)); } exprs.add("COUNT(1) as total"); queryBuilder.append("SELECT\n"); queryBuilder.append(Joiner.on(",\n").join(exprs)); queryBuilder.append(format("\nFROM %s as dremio_preview_data", datasetPreviewTable)); return queryBuilder.toString(); } | CardGenerator { <T> String generateMatchCountQuery(String inputColName, String datasetPreviewTable, List<TransformRuleWrapper<T>> evaluators) { StringBuilder queryBuilder = new StringBuilder(); String inputExpr = String.format("%s.%s", quoteIdentifier("dremio_preview_data"), quoteIdentifier(inputColName)); List<String> exprs = Lists.newArrayList(); for(int i=0; i<evaluators.size(); i++) { final String expr = evaluators.get(i).getMatchFunctionExpr(inputExpr); final String outputColAlias = "matched_count_" + i; exprs.add(String.format("sum(CASE WHEN %s THEN 1 ELSE 0 END) AS %s", expr, outputColAlias)); } exprs.add("COUNT(1) as total"); queryBuilder.append("SELECT\n"); queryBuilder.append(Joiner.on(",\n").join(exprs)); queryBuilder.append(format("\nFROM %s as dremio_preview_data", datasetPreviewTable)); return queryBuilder.toString(); } } | CardGenerator { <T> String generateMatchCountQuery(String inputColName, String datasetPreviewTable, List<TransformRuleWrapper<T>> evaluators) { StringBuilder queryBuilder = new StringBuilder(); String inputExpr = String.format("%s.%s", quoteIdentifier("dremio_preview_data"), quoteIdentifier(inputColName)); List<String> exprs = Lists.newArrayList(); for(int i=0; i<evaluators.size(); i++) { final String expr = evaluators.get(i).getMatchFunctionExpr(inputExpr); final String outputColAlias = "matched_count_" + i; exprs.add(String.format("sum(CASE WHEN %s THEN 1 ELSE 0 END) AS %s", expr, outputColAlias)); } exprs.add("COUNT(1) as total"); queryBuilder.append("SELECT\n"); queryBuilder.append(Joiner.on(",\n").join(exprs)); queryBuilder.append(format("\nFROM %s as dremio_preview_data", datasetPreviewTable)); return queryBuilder.toString(); } CardGenerator(final QueryExecutor executor, DatasetPath datasetPath, DatasetVersion version); } | CardGenerator { <T> String generateMatchCountQuery(String inputColName, String datasetPreviewTable, List<TransformRuleWrapper<T>> evaluators) { StringBuilder queryBuilder = new StringBuilder(); String inputExpr = String.format("%s.%s", quoteIdentifier("dremio_preview_data"), quoteIdentifier(inputColName)); List<String> exprs = Lists.newArrayList(); for(int i=0; i<evaluators.size(); i++) { final String expr = evaluators.get(i).getMatchFunctionExpr(inputExpr); final String outputColAlias = "matched_count_" + i; exprs.add(String.format("sum(CASE WHEN %s THEN 1 ELSE 0 END) AS %s", expr, outputColAlias)); } exprs.add("COUNT(1) as total"); queryBuilder.append("SELECT\n"); queryBuilder.append(Joiner.on(",\n").join(exprs)); queryBuilder.append(format("\nFROM %s as dremio_preview_data", datasetPreviewTable)); return queryBuilder.toString(); } CardGenerator(final QueryExecutor executor, DatasetPath datasetPath, DatasetVersion version); List<Card<T>> generateCards(SqlQuery datasetSql, String colName,
List<TransformRuleWrapper<T>> transformRuleWrappers, Comparator<Card<T>> comparator, BufferAllocator allocator); } | CardGenerator { <T> String generateMatchCountQuery(String inputColName, String datasetPreviewTable, List<TransformRuleWrapper<T>> evaluators) { StringBuilder queryBuilder = new StringBuilder(); String inputExpr = String.format("%s.%s", quoteIdentifier("dremio_preview_data"), quoteIdentifier(inputColName)); List<String> exprs = Lists.newArrayList(); for(int i=0; i<evaluators.size(); i++) { final String expr = evaluators.get(i).getMatchFunctionExpr(inputExpr); final String outputColAlias = "matched_count_" + i; exprs.add(String.format("sum(CASE WHEN %s THEN 1 ELSE 0 END) AS %s", expr, outputColAlias)); } exprs.add("COUNT(1) as total"); queryBuilder.append("SELECT\n"); queryBuilder.append(Joiner.on(",\n").join(exprs)); queryBuilder.append(format("\nFROM %s as dremio_preview_data", datasetPreviewTable)); return queryBuilder.toString(); } CardGenerator(final QueryExecutor executor, DatasetPath datasetPath, DatasetVersion version); List<Card<T>> generateCards(SqlQuery datasetSql, String colName,
List<TransformRuleWrapper<T>> transformRuleWrappers, Comparator<Card<T>> comparator, BufferAllocator allocator); } |
@Test public void ruleSuggestionsSelNumberInTheBeginning() { Selection selection = new Selection("col", "883 N Shoreline Blvd., Mountain View, CA 94043", 0, 3); List<ExtractRule> rules = recommender.getRules(selection, TEXT); assertEquals(5, rules.size()); comparePattern("\\d+", 0, INDEX, rules.get(0).getPattern()); comparePattern("\\w+", 0, INDEX, rules.get(1).getPattern()); comparePos(0, true, 2, true, rules.get(2).getPosition()); comparePos(0, true, 43, false, rules.get(3).getPosition()); comparePos(45, false, 43, false, rules.get(4).getPosition()); } | @Override public List<ExtractRule> getRules(Selection selection, DataType selColType) { checkArgument(selColType == DataType.TEXT, "Extract text is supported only on TEXT type columns"); if (selection.getLength() <= 0) { throw UserException.validationError() .message("text recommendation requires non-empty text selection") .build(logger); } List<ExtractRule> rules = new ArrayList<>(); rules.addAll(recommendCharacterGroup(selection)); rules.addAll(recommendPosition(selection)); return rules; } | ExtractRecommender extends Recommender<ExtractRule, Selection> { @Override public List<ExtractRule> getRules(Selection selection, DataType selColType) { checkArgument(selColType == DataType.TEXT, "Extract text is supported only on TEXT type columns"); if (selection.getLength() <= 0) { throw UserException.validationError() .message("text recommendation requires non-empty text selection") .build(logger); } List<ExtractRule> rules = new ArrayList<>(); rules.addAll(recommendCharacterGroup(selection)); rules.addAll(recommendPosition(selection)); return rules; } } | ExtractRecommender extends Recommender<ExtractRule, Selection> { @Override public List<ExtractRule> getRules(Selection selection, DataType selColType) { checkArgument(selColType == DataType.TEXT, "Extract text is supported only on TEXT type columns"); if (selection.getLength() <= 0) { throw UserException.validationError() .message("text recommendation requires non-empty text selection") .build(logger); } List<ExtractRule> rules = new ArrayList<>(); rules.addAll(recommendCharacterGroup(selection)); rules.addAll(recommendPosition(selection)); return rules; } } | ExtractRecommender extends Recommender<ExtractRule, Selection> { @Override public List<ExtractRule> getRules(Selection selection, DataType selColType) { checkArgument(selColType == DataType.TEXT, "Extract text is supported only on TEXT type columns"); if (selection.getLength() <= 0) { throw UserException.validationError() .message("text recommendation requires non-empty text selection") .build(logger); } List<ExtractRule> rules = new ArrayList<>(); rules.addAll(recommendCharacterGroup(selection)); rules.addAll(recommendPosition(selection)); return rules; } @Override List<ExtractRule> getRules(Selection selection, DataType selColType); TransformRuleWrapper<ExtractRule> wrapRule(ExtractRule extractRule); static String describePlacement(Offset start, Offset end); static String describeExtractRulePattern(ExtractRulePattern extractRulePattern); static String describe(ExtractRule rule); } | ExtractRecommender extends Recommender<ExtractRule, Selection> { @Override public List<ExtractRule> getRules(Selection selection, DataType selColType) { checkArgument(selColType == DataType.TEXT, "Extract text is supported only on TEXT type columns"); if (selection.getLength() <= 0) { throw UserException.validationError() .message("text recommendation requires non-empty text selection") .build(logger); } List<ExtractRule> rules = new ArrayList<>(); rules.addAll(recommendCharacterGroup(selection)); rules.addAll(recommendPosition(selection)); return rules; } @Override List<ExtractRule> getRules(Selection selection, DataType selColType); TransformRuleWrapper<ExtractRule> wrapRule(ExtractRule extractRule); static String describePlacement(Offset start, Offset end); static String describeExtractRulePattern(ExtractRulePattern extractRulePattern); static String describe(ExtractRule rule); } |
@Test public void ruleSuggestionsSelNumberAtTheEnd() { Selection selection = new Selection("col", "883 N Shoreline Blvd., Mountain View, CA 94043", 41, 5); List<ExtractRule> rules = recommender.getRules(selection, TEXT); assertEquals(7, rules.size()); comparePattern("\\d+", 1, INDEX, rules.get(0).getPattern()); comparePattern("\\d+", 0, INDEX_BACKWARDS, rules.get(1).getPattern()); comparePattern("\\w+", 7, INDEX, rules.get(2).getPattern()); comparePattern("\\w+", 0, INDEX_BACKWARDS, rules.get(3).getPattern()); comparePos(41, true, 45, true, rules.get(4).getPosition()); comparePos(41, true, 0, false, rules.get(5).getPosition()); comparePos(4, false, 0, false, rules.get(6).getPosition()); } | @Override public List<ExtractRule> getRules(Selection selection, DataType selColType) { checkArgument(selColType == DataType.TEXT, "Extract text is supported only on TEXT type columns"); if (selection.getLength() <= 0) { throw UserException.validationError() .message("text recommendation requires non-empty text selection") .build(logger); } List<ExtractRule> rules = new ArrayList<>(); rules.addAll(recommendCharacterGroup(selection)); rules.addAll(recommendPosition(selection)); return rules; } | ExtractRecommender extends Recommender<ExtractRule, Selection> { @Override public List<ExtractRule> getRules(Selection selection, DataType selColType) { checkArgument(selColType == DataType.TEXT, "Extract text is supported only on TEXT type columns"); if (selection.getLength() <= 0) { throw UserException.validationError() .message("text recommendation requires non-empty text selection") .build(logger); } List<ExtractRule> rules = new ArrayList<>(); rules.addAll(recommendCharacterGroup(selection)); rules.addAll(recommendPosition(selection)); return rules; } } | ExtractRecommender extends Recommender<ExtractRule, Selection> { @Override public List<ExtractRule> getRules(Selection selection, DataType selColType) { checkArgument(selColType == DataType.TEXT, "Extract text is supported only on TEXT type columns"); if (selection.getLength() <= 0) { throw UserException.validationError() .message("text recommendation requires non-empty text selection") .build(logger); } List<ExtractRule> rules = new ArrayList<>(); rules.addAll(recommendCharacterGroup(selection)); rules.addAll(recommendPosition(selection)); return rules; } } | ExtractRecommender extends Recommender<ExtractRule, Selection> { @Override public List<ExtractRule> getRules(Selection selection, DataType selColType) { checkArgument(selColType == DataType.TEXT, "Extract text is supported only on TEXT type columns"); if (selection.getLength() <= 0) { throw UserException.validationError() .message("text recommendation requires non-empty text selection") .build(logger); } List<ExtractRule> rules = new ArrayList<>(); rules.addAll(recommendCharacterGroup(selection)); rules.addAll(recommendPosition(selection)); return rules; } @Override List<ExtractRule> getRules(Selection selection, DataType selColType); TransformRuleWrapper<ExtractRule> wrapRule(ExtractRule extractRule); static String describePlacement(Offset start, Offset end); static String describeExtractRulePattern(ExtractRulePattern extractRulePattern); static String describe(ExtractRule rule); } | ExtractRecommender extends Recommender<ExtractRule, Selection> { @Override public List<ExtractRule> getRules(Selection selection, DataType selColType) { checkArgument(selColType == DataType.TEXT, "Extract text is supported only on TEXT type columns"); if (selection.getLength() <= 0) { throw UserException.validationError() .message("text recommendation requires non-empty text selection") .build(logger); } List<ExtractRule> rules = new ArrayList<>(); rules.addAll(recommendCharacterGroup(selection)); rules.addAll(recommendPosition(selection)); return rules; } @Override List<ExtractRule> getRules(Selection selection, DataType selColType); TransformRuleWrapper<ExtractRule> wrapRule(ExtractRule extractRule); static String describePlacement(Offset start, Offset end); static String describeExtractRulePattern(ExtractRulePattern extractRulePattern); static String describe(ExtractRule rule); } |
@Test public void ruleSuggestionsSelStateAtTheEnd() { Selection selection = new Selection("col", "883 N Shoreline Blvd., Mountain View, CA 94043", 38, 2); List<ExtractRule> rules = recommender.getRules(selection, TEXT); assertEquals(4, rules.size()); comparePattern("\\w+", 6, INDEX, rules.get(0).getPattern()); comparePos(38, true, 39, true, rules.get(1).getPosition()); comparePos(38, true, 6, false, rules.get(2).getPosition()); comparePos(7, false, 6, false, rules.get(3).getPosition()); } | @Override public List<ExtractRule> getRules(Selection selection, DataType selColType) { checkArgument(selColType == DataType.TEXT, "Extract text is supported only on TEXT type columns"); if (selection.getLength() <= 0) { throw UserException.validationError() .message("text recommendation requires non-empty text selection") .build(logger); } List<ExtractRule> rules = new ArrayList<>(); rules.addAll(recommendCharacterGroup(selection)); rules.addAll(recommendPosition(selection)); return rules; } | ExtractRecommender extends Recommender<ExtractRule, Selection> { @Override public List<ExtractRule> getRules(Selection selection, DataType selColType) { checkArgument(selColType == DataType.TEXT, "Extract text is supported only on TEXT type columns"); if (selection.getLength() <= 0) { throw UserException.validationError() .message("text recommendation requires non-empty text selection") .build(logger); } List<ExtractRule> rules = new ArrayList<>(); rules.addAll(recommendCharacterGroup(selection)); rules.addAll(recommendPosition(selection)); return rules; } } | ExtractRecommender extends Recommender<ExtractRule, Selection> { @Override public List<ExtractRule> getRules(Selection selection, DataType selColType) { checkArgument(selColType == DataType.TEXT, "Extract text is supported only on TEXT type columns"); if (selection.getLength() <= 0) { throw UserException.validationError() .message("text recommendation requires non-empty text selection") .build(logger); } List<ExtractRule> rules = new ArrayList<>(); rules.addAll(recommendCharacterGroup(selection)); rules.addAll(recommendPosition(selection)); return rules; } } | ExtractRecommender extends Recommender<ExtractRule, Selection> { @Override public List<ExtractRule> getRules(Selection selection, DataType selColType) { checkArgument(selColType == DataType.TEXT, "Extract text is supported only on TEXT type columns"); if (selection.getLength() <= 0) { throw UserException.validationError() .message("text recommendation requires non-empty text selection") .build(logger); } List<ExtractRule> rules = new ArrayList<>(); rules.addAll(recommendCharacterGroup(selection)); rules.addAll(recommendPosition(selection)); return rules; } @Override List<ExtractRule> getRules(Selection selection, DataType selColType); TransformRuleWrapper<ExtractRule> wrapRule(ExtractRule extractRule); static String describePlacement(Offset start, Offset end); static String describeExtractRulePattern(ExtractRulePattern extractRulePattern); static String describe(ExtractRule rule); } | ExtractRecommender extends Recommender<ExtractRule, Selection> { @Override public List<ExtractRule> getRules(Selection selection, DataType selColType) { checkArgument(selColType == DataType.TEXT, "Extract text is supported only on TEXT type columns"); if (selection.getLength() <= 0) { throw UserException.validationError() .message("text recommendation requires non-empty text selection") .build(logger); } List<ExtractRule> rules = new ArrayList<>(); rules.addAll(recommendCharacterGroup(selection)); rules.addAll(recommendPosition(selection)); return rules; } @Override List<ExtractRule> getRules(Selection selection, DataType selColType); TransformRuleWrapper<ExtractRule> wrapRule(ExtractRule extractRule); static String describePlacement(Offset start, Offset end); static String describeExtractRulePattern(ExtractRulePattern extractRulePattern); static String describe(ExtractRule rule); } |
@Test public void emptySelection() { boolean exThrown = false; try { recommender.getRules(new Selection("col", "883 N Shoreline Blvd.", 5, 0), TEXT); fail("not expected to reach here"); } catch (UserException e) { exThrown = true; assertEquals("text recommendation requires non-empty text selection", e.getMessage()); } assertTrue("expected a UserException", exThrown); } | @Override public List<ExtractRule> getRules(Selection selection, DataType selColType) { checkArgument(selColType == DataType.TEXT, "Extract text is supported only on TEXT type columns"); if (selection.getLength() <= 0) { throw UserException.validationError() .message("text recommendation requires non-empty text selection") .build(logger); } List<ExtractRule> rules = new ArrayList<>(); rules.addAll(recommendCharacterGroup(selection)); rules.addAll(recommendPosition(selection)); return rules; } | ExtractRecommender extends Recommender<ExtractRule, Selection> { @Override public List<ExtractRule> getRules(Selection selection, DataType selColType) { checkArgument(selColType == DataType.TEXT, "Extract text is supported only on TEXT type columns"); if (selection.getLength() <= 0) { throw UserException.validationError() .message("text recommendation requires non-empty text selection") .build(logger); } List<ExtractRule> rules = new ArrayList<>(); rules.addAll(recommendCharacterGroup(selection)); rules.addAll(recommendPosition(selection)); return rules; } } | ExtractRecommender extends Recommender<ExtractRule, Selection> { @Override public List<ExtractRule> getRules(Selection selection, DataType selColType) { checkArgument(selColType == DataType.TEXT, "Extract text is supported only on TEXT type columns"); if (selection.getLength() <= 0) { throw UserException.validationError() .message("text recommendation requires non-empty text selection") .build(logger); } List<ExtractRule> rules = new ArrayList<>(); rules.addAll(recommendCharacterGroup(selection)); rules.addAll(recommendPosition(selection)); return rules; } } | ExtractRecommender extends Recommender<ExtractRule, Selection> { @Override public List<ExtractRule> getRules(Selection selection, DataType selColType) { checkArgument(selColType == DataType.TEXT, "Extract text is supported only on TEXT type columns"); if (selection.getLength() <= 0) { throw UserException.validationError() .message("text recommendation requires non-empty text selection") .build(logger); } List<ExtractRule> rules = new ArrayList<>(); rules.addAll(recommendCharacterGroup(selection)); rules.addAll(recommendPosition(selection)); return rules; } @Override List<ExtractRule> getRules(Selection selection, DataType selColType); TransformRuleWrapper<ExtractRule> wrapRule(ExtractRule extractRule); static String describePlacement(Offset start, Offset end); static String describeExtractRulePattern(ExtractRulePattern extractRulePattern); static String describe(ExtractRule rule); } | ExtractRecommender extends Recommender<ExtractRule, Selection> { @Override public List<ExtractRule> getRules(Selection selection, DataType selColType) { checkArgument(selColType == DataType.TEXT, "Extract text is supported only on TEXT type columns"); if (selection.getLength() <= 0) { throw UserException.validationError() .message("text recommendation requires non-empty text selection") .build(logger); } List<ExtractRule> rules = new ArrayList<>(); rules.addAll(recommendCharacterGroup(selection)); rules.addAll(recommendPosition(selection)); return rules; } @Override List<ExtractRule> getRules(Selection selection, DataType selColType); TransformRuleWrapper<ExtractRule> wrapRule(ExtractRule extractRule); static String describePlacement(Offset start, Offset end); static String describeExtractRulePattern(ExtractRulePattern extractRulePattern); static String describe(ExtractRule rule); } |
@Test public void testRecommendCharacterGroup() { List<ExtractRule> cards = recommender.recommendCharacterGroup(new Selection("col", "abc def,ghi", 4, 3)); assertEquals(1, cards.size()); assertEquals(pattern, cards.get(0).getType()); ExtractRulePattern pattern = cards.get(0).getPattern(); assertEquals(1, pattern.getIndex().intValue()); assertEquals(WORD.pattern(), pattern.getPattern()); assertEquals(INDEX, pattern.getIndexType()); } | List<ExtractRule> recommendCharacterGroup(Selection selection) { List<ExtractRule> rules = new ArrayList<>(); String cellText = selection.getCellText(); int start = selection.getOffset(); int end = start + selection.getLength(); String selected = cellText.substring(start, end); for (CharType charType : PatternMatchUtils.CharType.values()) { boolean startIsCharType = start == 0 ? false : charType.isTypeOf(cellText.charAt(start - 1)); boolean endIsCharType = end == cellText.length() ? false : charType.isTypeOf(cellText.charAt(end)); boolean selectionIsCharType = charType.isTypeOf(selected); if (!startIsCharType && !endIsCharType && selectionIsCharType) { Matcher matcher = charType.matcher(cellText); List<Match> matches = PatternMatchUtils.findMatches(matcher, cellText, INDEX); for (int index = 0; index < matches.size(); index++) { Match match = matches.get(index); if (match.start() == start && match.end() == end) { rules.add(DatasetsUtil.pattern(charType.pattern(), index, INDEX)); if (index == matches.size() - 1) { rules.add(DatasetsUtil.pattern(charType.pattern(), 0, INDEX_BACKWARDS)); } } } } } return rules; } | ExtractRecommender extends Recommender<ExtractRule, Selection> { List<ExtractRule> recommendCharacterGroup(Selection selection) { List<ExtractRule> rules = new ArrayList<>(); String cellText = selection.getCellText(); int start = selection.getOffset(); int end = start + selection.getLength(); String selected = cellText.substring(start, end); for (CharType charType : PatternMatchUtils.CharType.values()) { boolean startIsCharType = start == 0 ? false : charType.isTypeOf(cellText.charAt(start - 1)); boolean endIsCharType = end == cellText.length() ? false : charType.isTypeOf(cellText.charAt(end)); boolean selectionIsCharType = charType.isTypeOf(selected); if (!startIsCharType && !endIsCharType && selectionIsCharType) { Matcher matcher = charType.matcher(cellText); List<Match> matches = PatternMatchUtils.findMatches(matcher, cellText, INDEX); for (int index = 0; index < matches.size(); index++) { Match match = matches.get(index); if (match.start() == start && match.end() == end) { rules.add(DatasetsUtil.pattern(charType.pattern(), index, INDEX)); if (index == matches.size() - 1) { rules.add(DatasetsUtil.pattern(charType.pattern(), 0, INDEX_BACKWARDS)); } } } } } return rules; } } | ExtractRecommender extends Recommender<ExtractRule, Selection> { List<ExtractRule> recommendCharacterGroup(Selection selection) { List<ExtractRule> rules = new ArrayList<>(); String cellText = selection.getCellText(); int start = selection.getOffset(); int end = start + selection.getLength(); String selected = cellText.substring(start, end); for (CharType charType : PatternMatchUtils.CharType.values()) { boolean startIsCharType = start == 0 ? false : charType.isTypeOf(cellText.charAt(start - 1)); boolean endIsCharType = end == cellText.length() ? false : charType.isTypeOf(cellText.charAt(end)); boolean selectionIsCharType = charType.isTypeOf(selected); if (!startIsCharType && !endIsCharType && selectionIsCharType) { Matcher matcher = charType.matcher(cellText); List<Match> matches = PatternMatchUtils.findMatches(matcher, cellText, INDEX); for (int index = 0; index < matches.size(); index++) { Match match = matches.get(index); if (match.start() == start && match.end() == end) { rules.add(DatasetsUtil.pattern(charType.pattern(), index, INDEX)); if (index == matches.size() - 1) { rules.add(DatasetsUtil.pattern(charType.pattern(), 0, INDEX_BACKWARDS)); } } } } } return rules; } } | ExtractRecommender extends Recommender<ExtractRule, Selection> { List<ExtractRule> recommendCharacterGroup(Selection selection) { List<ExtractRule> rules = new ArrayList<>(); String cellText = selection.getCellText(); int start = selection.getOffset(); int end = start + selection.getLength(); String selected = cellText.substring(start, end); for (CharType charType : PatternMatchUtils.CharType.values()) { boolean startIsCharType = start == 0 ? false : charType.isTypeOf(cellText.charAt(start - 1)); boolean endIsCharType = end == cellText.length() ? false : charType.isTypeOf(cellText.charAt(end)); boolean selectionIsCharType = charType.isTypeOf(selected); if (!startIsCharType && !endIsCharType && selectionIsCharType) { Matcher matcher = charType.matcher(cellText); List<Match> matches = PatternMatchUtils.findMatches(matcher, cellText, INDEX); for (int index = 0; index < matches.size(); index++) { Match match = matches.get(index); if (match.start() == start && match.end() == end) { rules.add(DatasetsUtil.pattern(charType.pattern(), index, INDEX)); if (index == matches.size() - 1) { rules.add(DatasetsUtil.pattern(charType.pattern(), 0, INDEX_BACKWARDS)); } } } } } return rules; } @Override List<ExtractRule> getRules(Selection selection, DataType selColType); TransformRuleWrapper<ExtractRule> wrapRule(ExtractRule extractRule); static String describePlacement(Offset start, Offset end); static String describeExtractRulePattern(ExtractRulePattern extractRulePattern); static String describe(ExtractRule rule); } | ExtractRecommender extends Recommender<ExtractRule, Selection> { List<ExtractRule> recommendCharacterGroup(Selection selection) { List<ExtractRule> rules = new ArrayList<>(); String cellText = selection.getCellText(); int start = selection.getOffset(); int end = start + selection.getLength(); String selected = cellText.substring(start, end); for (CharType charType : PatternMatchUtils.CharType.values()) { boolean startIsCharType = start == 0 ? false : charType.isTypeOf(cellText.charAt(start - 1)); boolean endIsCharType = end == cellText.length() ? false : charType.isTypeOf(cellText.charAt(end)); boolean selectionIsCharType = charType.isTypeOf(selected); if (!startIsCharType && !endIsCharType && selectionIsCharType) { Matcher matcher = charType.matcher(cellText); List<Match> matches = PatternMatchUtils.findMatches(matcher, cellText, INDEX); for (int index = 0; index < matches.size(); index++) { Match match = matches.get(index); if (match.start() == start && match.end() == end) { rules.add(DatasetsUtil.pattern(charType.pattern(), index, INDEX)); if (index == matches.size() - 1) { rules.add(DatasetsUtil.pattern(charType.pattern(), 0, INDEX_BACKWARDS)); } } } } } return rules; } @Override List<ExtractRule> getRules(Selection selection, DataType selColType); TransformRuleWrapper<ExtractRule> wrapRule(ExtractRule extractRule); static String describePlacement(Offset start, Offset end); static String describeExtractRulePattern(ExtractRulePattern extractRulePattern); static String describe(ExtractRule rule); } |
@Test public void testStar() { VirtualDatasetState ds = extract( getQueryFromSQL("select * from " + table)); assertEquals( new VirtualDatasetState() .setFrom(from) .setContextList(Collections.<String>emptyList()) .setReferredTablesList(Arrays.asList("tpch/supplier.parquet")) .setColumnsList(cols("s_suppkey", "s_name", "s_address", "s_nationkey", "s_phone", "s_acctbal", "s_comment")), ds); } | public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); static VirtualDatasetState extract(QueryMetadata metadata); static void populateSemanticFields(List<ViewFieldType> viewFieldTypes, VirtualDatasetState state); } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); static VirtualDatasetState extract(QueryMetadata metadata); static void populateSemanticFields(List<ViewFieldType> viewFieldTypes, VirtualDatasetState state); } |
@Test public void testPre4x0Version() throws Exception { final Version version = new Version("3.9.0", 3, 9, 0, 0, ""); assertTrue(SetTableauDefaults.updateOptionsIfNeeded(version, () -> optionManager, true)); assertTrue(optionManager.getOption(TableauResource.CLIENT_TOOLS_TABLEAU)); } | @VisibleForTesting static boolean updateOptionsIfNeeded(Version previousVersion, Supplier<SystemOptionManager> optionManagerSupplier, boolean isOptionManagerOpen) throws Exception { if (Upgrade.UPGRADE_VERSION_ORDERING.compare(previousVersion, VERSION_460) >= 0) { return false; } final SystemOptionManager optionManager = optionManagerSupplier.get(); try { if (!isOptionManagerOpen) { optionManager.start(); } final OptionValue regularTableauDefault = TableauResource.CLIENT_TOOLS_TABLEAU.getDefault(); final OptionValue tableauEnable = OptionValue.createBoolean(regularTableauDefault.getType(), regularTableauDefault.getName(), true); if (!optionManager.isSet(TableauResource.CLIENT_TOOLS_TABLEAU.getOptionName())) { optionManager.setOption(tableauEnable); return true; } return false; } finally { if (!isOptionManagerOpen) { optionManager.close(); } } } | SetTableauDefaults extends UpgradeTask { @VisibleForTesting static boolean updateOptionsIfNeeded(Version previousVersion, Supplier<SystemOptionManager> optionManagerSupplier, boolean isOptionManagerOpen) throws Exception { if (Upgrade.UPGRADE_VERSION_ORDERING.compare(previousVersion, VERSION_460) >= 0) { return false; } final SystemOptionManager optionManager = optionManagerSupplier.get(); try { if (!isOptionManagerOpen) { optionManager.start(); } final OptionValue regularTableauDefault = TableauResource.CLIENT_TOOLS_TABLEAU.getDefault(); final OptionValue tableauEnable = OptionValue.createBoolean(regularTableauDefault.getType(), regularTableauDefault.getName(), true); if (!optionManager.isSet(TableauResource.CLIENT_TOOLS_TABLEAU.getOptionName())) { optionManager.setOption(tableauEnable); return true; } return false; } finally { if (!isOptionManagerOpen) { optionManager.close(); } } } } | SetTableauDefaults extends UpgradeTask { @VisibleForTesting static boolean updateOptionsIfNeeded(Version previousVersion, Supplier<SystemOptionManager> optionManagerSupplier, boolean isOptionManagerOpen) throws Exception { if (Upgrade.UPGRADE_VERSION_ORDERING.compare(previousVersion, VERSION_460) >= 0) { return false; } final SystemOptionManager optionManager = optionManagerSupplier.get(); try { if (!isOptionManagerOpen) { optionManager.start(); } final OptionValue regularTableauDefault = TableauResource.CLIENT_TOOLS_TABLEAU.getDefault(); final OptionValue tableauEnable = OptionValue.createBoolean(regularTableauDefault.getType(), regularTableauDefault.getName(), true); if (!optionManager.isSet(TableauResource.CLIENT_TOOLS_TABLEAU.getOptionName())) { optionManager.setOption(tableauEnable); return true; } return false; } finally { if (!isOptionManagerOpen) { optionManager.close(); } } } SetTableauDefaults(); } | SetTableauDefaults extends UpgradeTask { @VisibleForTesting static boolean updateOptionsIfNeeded(Version previousVersion, Supplier<SystemOptionManager> optionManagerSupplier, boolean isOptionManagerOpen) throws Exception { if (Upgrade.UPGRADE_VERSION_ORDERING.compare(previousVersion, VERSION_460) >= 0) { return false; } final SystemOptionManager optionManager = optionManagerSupplier.get(); try { if (!isOptionManagerOpen) { optionManager.start(); } final OptionValue regularTableauDefault = TableauResource.CLIENT_TOOLS_TABLEAU.getDefault(); final OptionValue tableauEnable = OptionValue.createBoolean(regularTableauDefault.getType(), regularTableauDefault.getName(), true); if (!optionManager.isSet(TableauResource.CLIENT_TOOLS_TABLEAU.getOptionName())) { optionManager.setOption(tableauEnable); return true; } return false; } finally { if (!isOptionManagerOpen) { optionManager.close(); } } } SetTableauDefaults(); @Override String getTaskUUID(); @Override void upgrade(UpgradeContext context); } | SetTableauDefaults extends UpgradeTask { @VisibleForTesting static boolean updateOptionsIfNeeded(Version previousVersion, Supplier<SystemOptionManager> optionManagerSupplier, boolean isOptionManagerOpen) throws Exception { if (Upgrade.UPGRADE_VERSION_ORDERING.compare(previousVersion, VERSION_460) >= 0) { return false; } final SystemOptionManager optionManager = optionManagerSupplier.get(); try { if (!isOptionManagerOpen) { optionManager.start(); } final OptionValue regularTableauDefault = TableauResource.CLIENT_TOOLS_TABLEAU.getDefault(); final OptionValue tableauEnable = OptionValue.createBoolean(regularTableauDefault.getType(), regularTableauDefault.getName(), true); if (!optionManager.isSet(TableauResource.CLIENT_TOOLS_TABLEAU.getOptionName())) { optionManager.setOption(tableauEnable); return true; } return false; } finally { if (!isOptionManagerOpen) { optionManager.close(); } } } SetTableauDefaults(); @Override String getTaskUUID(); @Override void upgrade(UpgradeContext context); } |
@Test public void selectConstant() { final String query = "SELECT 1729 AS special"; final VirtualDatasetState ds = extract(getQueryFromSQL(query)); assertEquals(ds, new VirtualDatasetState() .setFrom(new FromSQL(query).setAlias("nested_0").wrap()) .setContextList(Collections.<String>emptyList()) .setReferredTablesList(Collections.<String>emptyList()) .setColumnsList(cols("special"))); } | public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); static VirtualDatasetState extract(QueryMetadata metadata); static void populateSemanticFields(List<ViewFieldType> viewFieldTypes, VirtualDatasetState state); } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); static VirtualDatasetState extract(QueryMetadata metadata); static void populateSemanticFields(List<ViewFieldType> viewFieldTypes, VirtualDatasetState state); } |
@Test public void selectConstantNested() { final String query = "SELECT * FROM (SELECT 87539319 AS special ORDER BY 1 LIMIT 1)"; final VirtualDatasetState ds = extract(getQueryFromSQL(query)); assertEquals(new VirtualDatasetState() .setFrom(new FromSQL(query).setAlias("nested_0").wrap()) .setContextList(Collections.<String>emptyList()) .setReferredTablesList(Collections.<String>emptyList()) .setColumnsList(cols("special")), ds); } | public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); static VirtualDatasetState extract(QueryMetadata metadata); static void populateSemanticFields(List<ViewFieldType> viewFieldTypes, VirtualDatasetState state); } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); static VirtualDatasetState extract(QueryMetadata metadata); static void populateSemanticFields(List<ViewFieldType> viewFieldTypes, VirtualDatasetState state); } |
@Test public void testTimestampCloseToZero() throws Exception { VirtualDatasetState ds = extract( getQueryFromSQL( "select TIMESTAMP '1970-01-01 00:00:00.100' from sys.memory")); assertNotNull(ds); ds = extract( getQueryFromSQL( "select TIMESTAMP '1970-01-01 00:00:00.099' from sys.memory")); assertNotNull(ds); ds = extract( getQueryFromSQL( "select TIMESTAMP '1970-01-01 00:00:00.000' from sys.memory")); assertNotNull(ds); ds = extract( getQueryFromSQL( "select TIMESTAMP '1970-01-01 00:00:00.001' from sys.memory")); assertNotNull(ds); ds = extract( getQueryFromSQL( "select TIME '00:00:00.100' from sys.memory")); assertNotNull(ds); ds = extract( getQueryFromSQL( "select TIME '00:00:00.099' from sys.memory")); assertNotNull(ds); ds = extract( getQueryFromSQL( "select TIME '00:00:00.000' from sys.memory")); assertNotNull(ds); ds = extract( getQueryFromSQL( "select TIME '00:00:00.001' from sys.memory")); assertNotNull(ds); } | public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); static VirtualDatasetState extract(QueryMetadata metadata); static void populateSemanticFields(List<ViewFieldType> viewFieldTypes, VirtualDatasetState state); } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); static VirtualDatasetState extract(QueryMetadata metadata); static void populateSemanticFields(List<ViewFieldType> viewFieldTypes, VirtualDatasetState state); } |
@Test public void testStarAs() { VirtualDatasetState ds = extract( getQueryFromSQL("select * from " + table + " as foo")); assertEquals( new VirtualDatasetState() .setFrom(new FromTable(table).setAlias("foo").wrap()).setContextList(Collections.<String>emptyList()) .setReferredTablesList(Arrays.asList("tpch/supplier.parquet")) .setColumnsList(cols("s_suppkey", "s_name", "s_address", "s_nationkey", "s_phone", "s_acctbal", "s_comment")), ds); } | public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); static VirtualDatasetState extract(QueryMetadata metadata); static void populateSemanticFields(List<ViewFieldType> viewFieldTypes, VirtualDatasetState state); } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); static VirtualDatasetState extract(QueryMetadata metadata); static void populateSemanticFields(List<ViewFieldType> viewFieldTypes, VirtualDatasetState state); } |
@Test public void testFields() { VirtualDatasetState ds = extract( getQueryFromSQL("select s_suppkey, s_name, s_address from " + table)); assertEquals( new VirtualDatasetState() .setFrom(from) .setColumnsList(cols("s_suppkey", "s_name", "s_address")) .setContextList(Collections.<String>emptyList()) .setReferredTablesList(Arrays.asList("tpch/supplier.parquet")), ds); } | public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); static VirtualDatasetState extract(QueryMetadata metadata); static void populateSemanticFields(List<ViewFieldType> viewFieldTypes, VirtualDatasetState state); } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); static VirtualDatasetState extract(QueryMetadata metadata); static void populateSemanticFields(List<ViewFieldType> viewFieldTypes, VirtualDatasetState state); } |
@Test public void testFieldsAs() { VirtualDatasetState ds = extract( getQueryFromSQL("select s_suppkey, s_address as mycol from " + table)); assertEquals( new VirtualDatasetState() .setFrom(from) .setColumnsList(asList( new Column("s_suppkey", new ExpColumnReference("s_suppkey").wrap()), new Column("mycol", new ExpColumnReference("s_address").wrap()))) .setContextList(Collections.<String>emptyList()) .setReferredTablesList(Arrays.asList("tpch/supplier.parquet")), ds); } | public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); static VirtualDatasetState extract(QueryMetadata metadata); static void populateSemanticFields(List<ViewFieldType> viewFieldTypes, VirtualDatasetState state); } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); static VirtualDatasetState extract(QueryMetadata metadata); static void populateSemanticFields(List<ViewFieldType> viewFieldTypes, VirtualDatasetState state); } |
@Test public void testFlatten() { VirtualDatasetState ds = extract(getQueryFromSQL("select flatten(b), a as mycol from cp.\"json/nested.json\"")); assertEquals( new VirtualDatasetState() .setFrom(new FromTable("\"cp\".\"json/nested.json\"").setAlias("json/nested.json").wrap()) .setColumnsList(asList( new Column("EXPR$0", new ExpCalculatedField("FLATTEN(\"json/nested.json\".\"b\")").wrap()), new Column("mycol", new ExpColumnReference("a").wrap()))) .setContextList(Collections.<String>emptyList()) .setReferredTablesList(Arrays.asList("json/nested.json")), ds); } | public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); static VirtualDatasetState extract(QueryMetadata metadata); static void populateSemanticFields(List<ViewFieldType> viewFieldTypes, VirtualDatasetState state); } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); static VirtualDatasetState extract(QueryMetadata metadata); static void populateSemanticFields(List<ViewFieldType> viewFieldTypes, VirtualDatasetState state); } |
@Test public void testCount() { VirtualDatasetState ds = extract(getQueryFromSQL("select count(*) from cp.\"json/nested.json\"")); assertEquals( new VirtualDatasetState() .setFrom(new FromTable("\"cp\".\"json/nested.json\"").setAlias("json/nested.json").wrap()) .setColumnsList(asList( new Column("EXPR$0", new ExpCalculatedField("COUNT(*)").wrap()) )).setContextList(Collections.<String>emptyList()) .setReferredTablesList(Arrays.asList("json/nested.json")), ds); } | public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); static VirtualDatasetState extract(QueryMetadata metadata); static void populateSemanticFields(List<ViewFieldType> viewFieldTypes, VirtualDatasetState state); } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); static VirtualDatasetState extract(QueryMetadata metadata); static void populateSemanticFields(List<ViewFieldType> viewFieldTypes, VirtualDatasetState state); } |
@Test public void testFunctionUpper() { VirtualDatasetState ds = extract(getQueryFromSQL("select upper(a) from cp.\"json/convert_case.json\"")); assertEquals( new VirtualDatasetState() .setFrom(new FromTable("\"cp\".\"json/convert_case.json\"").setAlias("json/convert_case.json").wrap()) .setColumnsList(asList( new Column("EXPR$0", new ExpCalculatedField("UPPER(\"json/convert_case.json\".\"a\")").wrap()))) .setContextList(Collections.<String>emptyList()) .setReferredTablesList(Arrays.asList("json/convert_case.json")), ds); } | public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); static VirtualDatasetState extract(QueryMetadata metadata); static void populateSemanticFields(List<ViewFieldType> viewFieldTypes, VirtualDatasetState state); } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); static VirtualDatasetState extract(QueryMetadata metadata); static void populateSemanticFields(List<ViewFieldType> viewFieldTypes, VirtualDatasetState state); } |
@Test public void testOrder() { VirtualDatasetState ds = extract(getQueryFromSQL("select a from cp.\"json/nested.json\" order by a")); assertEquals( new VirtualDatasetState() .setFrom(new FromTable("\"cp\".\"json/nested.json\"").setAlias("json/nested.json").wrap()) .setColumnsList(cols("a")).setOrdersList(asList(new Order("a", ASC))) .setContextList(Collections.<String>emptyList()) .setReferredTablesList(Arrays.asList("json/nested.json")), ds); } | public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); static VirtualDatasetState extract(QueryMetadata metadata); static void populateSemanticFields(List<ViewFieldType> viewFieldTypes, VirtualDatasetState state); } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); static VirtualDatasetState extract(QueryMetadata metadata); static void populateSemanticFields(List<ViewFieldType> viewFieldTypes, VirtualDatasetState state); } |
@Test public void testPre460Version() throws Exception { final Version version = new Version("4.5.9", 4, 5, 9, 0, ""); assertTrue(SetTableauDefaults.updateOptionsIfNeeded(version, () -> optionManager, true)); assertTrue(optionManager.getOption(TableauResource.CLIENT_TOOLS_TABLEAU)); } | @VisibleForTesting static boolean updateOptionsIfNeeded(Version previousVersion, Supplier<SystemOptionManager> optionManagerSupplier, boolean isOptionManagerOpen) throws Exception { if (Upgrade.UPGRADE_VERSION_ORDERING.compare(previousVersion, VERSION_460) >= 0) { return false; } final SystemOptionManager optionManager = optionManagerSupplier.get(); try { if (!isOptionManagerOpen) { optionManager.start(); } final OptionValue regularTableauDefault = TableauResource.CLIENT_TOOLS_TABLEAU.getDefault(); final OptionValue tableauEnable = OptionValue.createBoolean(regularTableauDefault.getType(), regularTableauDefault.getName(), true); if (!optionManager.isSet(TableauResource.CLIENT_TOOLS_TABLEAU.getOptionName())) { optionManager.setOption(tableauEnable); return true; } return false; } finally { if (!isOptionManagerOpen) { optionManager.close(); } } } | SetTableauDefaults extends UpgradeTask { @VisibleForTesting static boolean updateOptionsIfNeeded(Version previousVersion, Supplier<SystemOptionManager> optionManagerSupplier, boolean isOptionManagerOpen) throws Exception { if (Upgrade.UPGRADE_VERSION_ORDERING.compare(previousVersion, VERSION_460) >= 0) { return false; } final SystemOptionManager optionManager = optionManagerSupplier.get(); try { if (!isOptionManagerOpen) { optionManager.start(); } final OptionValue regularTableauDefault = TableauResource.CLIENT_TOOLS_TABLEAU.getDefault(); final OptionValue tableauEnable = OptionValue.createBoolean(regularTableauDefault.getType(), regularTableauDefault.getName(), true); if (!optionManager.isSet(TableauResource.CLIENT_TOOLS_TABLEAU.getOptionName())) { optionManager.setOption(tableauEnable); return true; } return false; } finally { if (!isOptionManagerOpen) { optionManager.close(); } } } } | SetTableauDefaults extends UpgradeTask { @VisibleForTesting static boolean updateOptionsIfNeeded(Version previousVersion, Supplier<SystemOptionManager> optionManagerSupplier, boolean isOptionManagerOpen) throws Exception { if (Upgrade.UPGRADE_VERSION_ORDERING.compare(previousVersion, VERSION_460) >= 0) { return false; } final SystemOptionManager optionManager = optionManagerSupplier.get(); try { if (!isOptionManagerOpen) { optionManager.start(); } final OptionValue regularTableauDefault = TableauResource.CLIENT_TOOLS_TABLEAU.getDefault(); final OptionValue tableauEnable = OptionValue.createBoolean(regularTableauDefault.getType(), regularTableauDefault.getName(), true); if (!optionManager.isSet(TableauResource.CLIENT_TOOLS_TABLEAU.getOptionName())) { optionManager.setOption(tableauEnable); return true; } return false; } finally { if (!isOptionManagerOpen) { optionManager.close(); } } } SetTableauDefaults(); } | SetTableauDefaults extends UpgradeTask { @VisibleForTesting static boolean updateOptionsIfNeeded(Version previousVersion, Supplier<SystemOptionManager> optionManagerSupplier, boolean isOptionManagerOpen) throws Exception { if (Upgrade.UPGRADE_VERSION_ORDERING.compare(previousVersion, VERSION_460) >= 0) { return false; } final SystemOptionManager optionManager = optionManagerSupplier.get(); try { if (!isOptionManagerOpen) { optionManager.start(); } final OptionValue regularTableauDefault = TableauResource.CLIENT_TOOLS_TABLEAU.getDefault(); final OptionValue tableauEnable = OptionValue.createBoolean(regularTableauDefault.getType(), regularTableauDefault.getName(), true); if (!optionManager.isSet(TableauResource.CLIENT_TOOLS_TABLEAU.getOptionName())) { optionManager.setOption(tableauEnable); return true; } return false; } finally { if (!isOptionManagerOpen) { optionManager.close(); } } } SetTableauDefaults(); @Override String getTaskUUID(); @Override void upgrade(UpgradeContext context); } | SetTableauDefaults extends UpgradeTask { @VisibleForTesting static boolean updateOptionsIfNeeded(Version previousVersion, Supplier<SystemOptionManager> optionManagerSupplier, boolean isOptionManagerOpen) throws Exception { if (Upgrade.UPGRADE_VERSION_ORDERING.compare(previousVersion, VERSION_460) >= 0) { return false; } final SystemOptionManager optionManager = optionManagerSupplier.get(); try { if (!isOptionManagerOpen) { optionManager.start(); } final OptionValue regularTableauDefault = TableauResource.CLIENT_TOOLS_TABLEAU.getDefault(); final OptionValue tableauEnable = OptionValue.createBoolean(regularTableauDefault.getType(), regularTableauDefault.getName(), true); if (!optionManager.isSet(TableauResource.CLIENT_TOOLS_TABLEAU.getOptionName())) { optionManager.setOption(tableauEnable); return true; } return false; } finally { if (!isOptionManagerOpen) { optionManager.close(); } } } SetTableauDefaults(); @Override String getTaskUUID(); @Override void upgrade(UpgradeContext context); } |
@Test public void testMultipleOrder() { VirtualDatasetState ds = extract(getQueryFromSQL("select a, b from cp.\"json/nested.json\" order by b desc, a asc")); assertEquals( new VirtualDatasetState() .setFrom(new FromTable("\"cp\".\"json/nested.json\"").setAlias("json/nested.json").wrap()) .setColumnsList(cols("a", "b")) .setOrdersList(asList( new Order("b", DESC), new Order("a", ASC))) .setContextList(Collections.<String>emptyList()) .setReferredTablesList(Arrays.asList("json/nested.json")), ds); } | public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); static VirtualDatasetState extract(QueryMetadata metadata); static void populateSemanticFields(List<ViewFieldType> viewFieldTypes, VirtualDatasetState state); } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); static VirtualDatasetState extract(QueryMetadata metadata); static void populateSemanticFields(List<ViewFieldType> viewFieldTypes, VirtualDatasetState state); } |
@Test public void testOrderAlias() { VirtualDatasetState ds = extract(getQueryFromSQL("select a as b from cp.\"json/nested.json\" order by b")); assertEquals( new VirtualDatasetState() .setFrom(new FromTable("\"cp\".\"json/nested.json\"").setAlias("json/nested.json").wrap()) .setColumnsList(asList(new Column("b", new ExpColumnReference("a").wrap()))) .setOrdersList(asList(new Order("b", ASC))) .setContextList(Collections.<String>emptyList()) .setReferredTablesList(Arrays.asList("json/nested.json")), ds); } | public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); static VirtualDatasetState extract(QueryMetadata metadata); static void populateSemanticFields(List<ViewFieldType> viewFieldTypes, VirtualDatasetState state); } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); static VirtualDatasetState extract(QueryMetadata metadata); static void populateSemanticFields(List<ViewFieldType> viewFieldTypes, VirtualDatasetState state); } |
@Test public void testNestedColRef() { VirtualDatasetState ds = extract(getQueryFromSQL("select t.a.Tuesday as tuesday from cp.\"json/extract_map.json\" as t")); assertEquals( new VirtualDatasetState() .setFrom(new FromTable("\"cp\".\"json/extract_map.json\"").setAlias("t").wrap()) .setColumnsList(asList(new Column("tuesday", new ExpCalculatedField("\"t\".\"a\"['Tuesday']").wrap()))) .setContextList(Collections.<String>emptyList()) .setReferredTablesList(Arrays.asList("json/extract_map.json")), ds); } | public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); static VirtualDatasetState extract(QueryMetadata metadata); static void populateSemanticFields(List<ViewFieldType> viewFieldTypes, VirtualDatasetState state); } | QuerySemantics { public static VirtualDatasetState extract(QueryMetadata metadata) { final com.dremio.service.jobs.metadata.proto.VirtualDatasetState pState = metadata.getState(); final VirtualDatasetState state = new VirtualDatasetState(); if (pState.hasFrom()) { state.setFrom(fromBuf(pState.getFrom())); } if (pState.getColumnsCount() > 0) { state.setColumnsList( pState.getColumnsList() .stream() .map((c) -> new Column(c.getName(), fromBuf(c.getExpression()))) .collect(Collectors.toList())); } if (pState.getOrdersCount() > 0) { state.setOrdersList( pState.getOrdersList() .stream() .map((o) -> new Order(o.getName(), OrderDirection.valueOf(o.getDirection().name()))) .collect(Collectors.toList()) ); } state.setReferredTablesList(pState.getReferredTablesList()); state.setContextList(pState.getContextList()); return state; } private QuerySemantics(); static VirtualDatasetState extract(QueryMetadata metadata); static void populateSemanticFields(List<ViewFieldType> viewFieldTypes, VirtualDatasetState state); } |
@Test public void verifyDSRFile() { final PowerBIMessageBodyGenerator.DSRFile dsrFile = PowerBIMessageBodyGenerator.createDSRFile(server, datasetConfig); assertEquals("0.1", dsrFile.getVersion()); final PowerBIMessageBodyGenerator.Connection connection = dsrFile.getConnections()[0]; assertEquals("DirectQuery", connection.getMode()); final PowerBIMessageBodyGenerator.DataSourceReference details = connection.getDSR(); assertEquals("dremio", details.getProtocol()); final PowerBIMessageBodyGenerator.DSRConnectionInfo address = details.getAddress(); assertEquals(server, address.getServer()); assertEquals(expectedSchema, address.getSchema()); assertEquals(expectedTable, address.getTable()); } | @VisibleForTesting static DSRFile createDSRFile(String hostname, DatasetConfig datasetConfig) { final DSRConnectionInfo connInfo = new DSRConnectionInfo(); connInfo.server = hostname; final DatasetPath dataset = new DatasetPath(datasetConfig.getFullPathList()); connInfo.schema = String.join(".", datasetConfig.getFullPathList().subList(0, datasetConfig.getFullPathList().size() - 1)); connInfo.table = dataset.getLeaf().getName(); final DataSourceReference dsr = new DataSourceReference(connInfo); final Connection conn = new Connection(); conn.dsr = dsr; final DSRFile dsrFile = new DSRFile(); dsrFile.addConnection(conn); return dsrFile; } | PowerBIMessageBodyGenerator extends BaseBIToolMessageBodyGenerator { @VisibleForTesting static DSRFile createDSRFile(String hostname, DatasetConfig datasetConfig) { final DSRConnectionInfo connInfo = new DSRConnectionInfo(); connInfo.server = hostname; final DatasetPath dataset = new DatasetPath(datasetConfig.getFullPathList()); connInfo.schema = String.join(".", datasetConfig.getFullPathList().subList(0, datasetConfig.getFullPathList().size() - 1)); connInfo.table = dataset.getLeaf().getName(); final DataSourceReference dsr = new DataSourceReference(connInfo); final Connection conn = new Connection(); conn.dsr = dsr; final DSRFile dsrFile = new DSRFile(); dsrFile.addConnection(conn); return dsrFile; } } | PowerBIMessageBodyGenerator extends BaseBIToolMessageBodyGenerator { @VisibleForTesting static DSRFile createDSRFile(String hostname, DatasetConfig datasetConfig) { final DSRConnectionInfo connInfo = new DSRConnectionInfo(); connInfo.server = hostname; final DatasetPath dataset = new DatasetPath(datasetConfig.getFullPathList()); connInfo.schema = String.join(".", datasetConfig.getFullPathList().subList(0, datasetConfig.getFullPathList().size() - 1)); connInfo.table = dataset.getLeaf().getName(); final DataSourceReference dsr = new DataSourceReference(connInfo); final Connection conn = new Connection(); conn.dsr = dsr; final DSRFile dsrFile = new DSRFile(); dsrFile.addConnection(conn); return dsrFile; } @Inject PowerBIMessageBodyGenerator(@Context Configuration configuration, CoordinationProtos.NodeEndpoint endpoint); } | PowerBIMessageBodyGenerator extends BaseBIToolMessageBodyGenerator { @VisibleForTesting static DSRFile createDSRFile(String hostname, DatasetConfig datasetConfig) { final DSRConnectionInfo connInfo = new DSRConnectionInfo(); connInfo.server = hostname; final DatasetPath dataset = new DatasetPath(datasetConfig.getFullPathList()); connInfo.schema = String.join(".", datasetConfig.getFullPathList().subList(0, datasetConfig.getFullPathList().size() - 1)); connInfo.table = dataset.getLeaf().getName(); final DataSourceReference dsr = new DataSourceReference(connInfo); final Connection conn = new Connection(); conn.dsr = dsr; final DSRFile dsrFile = new DSRFile(); dsrFile.addConnection(conn); return dsrFile; } @Inject PowerBIMessageBodyGenerator(@Context Configuration configuration, CoordinationProtos.NodeEndpoint endpoint); @Override void writeTo(DatasetConfig datasetConfig, Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream outputStream); } | PowerBIMessageBodyGenerator extends BaseBIToolMessageBodyGenerator { @VisibleForTesting static DSRFile createDSRFile(String hostname, DatasetConfig datasetConfig) { final DSRConnectionInfo connInfo = new DSRConnectionInfo(); connInfo.server = hostname; final DatasetPath dataset = new DatasetPath(datasetConfig.getFullPathList()); connInfo.schema = String.join(".", datasetConfig.getFullPathList().subList(0, datasetConfig.getFullPathList().size() - 1)); connInfo.table = dataset.getLeaf().getName(); final DataSourceReference dsr = new DataSourceReference(connInfo); final Connection conn = new Connection(); conn.dsr = dsr; final DSRFile dsrFile = new DSRFile(); dsrFile.addConnection(conn); return dsrFile; } @Inject PowerBIMessageBodyGenerator(@Context Configuration configuration, CoordinationProtos.NodeEndpoint endpoint); @Override void writeTo(DatasetConfig datasetConfig, Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream outputStream); } |
@Test public void testAddSourceWithAccelerationTTL() throws Exception { final String sourceName = "src"; final long refreshPeriod = TimeUnit.HOURS.toMillis(4); final long gracePeriod = TimeUnit.HOURS.toMillis(12); { final NASConf nas = new NASConf(); nas.path = folder.getRoot().getPath(); SourceUI source = new SourceUI(); source.setName(sourceName); source.setCtime(System.currentTimeMillis()); source.setAccelerationRefreshPeriod(refreshPeriod); source.setAccelerationGracePeriod(gracePeriod); source.setConfig(nas); expectSuccess( getBuilder(getAPIv2().path(String.format("/source/%s", sourceName))) .buildPut(Entity.entity(source, JSON))); final SourceUI result = expectSuccess( getBuilder(getAPIv2().path(String.format("/source/%s", sourceName))).buildGet(), SourceUI.class ); assertEquals(source.getFullPathList(), result.getFullPathList()); assertEquals(source.getAccelerationRefreshPeriod(), result.getAccelerationRefreshPeriod()); assertEquals(source.getAccelerationGracePeriod(), result.getAccelerationGracePeriod()); newNamespaceService().deleteSource(new SourcePath(sourceName).toNamespaceKey(), result.getTag()); } } | @RolesAllowed("admin") @DELETE @Produces(MediaType.APPLICATION_JSON) public void deleteSource(@QueryParam("version") String version) throws NamespaceException, SourceNotFoundException { if (version == null) { throw new ClientErrorException("missing version parameter"); } try { SourceConfig config = namespaceService.getSource(new SourcePath(sourceName).toNamespaceKey()); if(!Objects.equals(config.getTag(), version)) { throw new ConcurrentModificationException(String.format("Unable to delete source, expected version %s, received version %s.", config.getTag(), version)); } sourceCatalog.deleteSource(config); } catch (NamespaceNotFoundException nfe) { throw new SourceNotFoundException(sourcePath.getSourceName().getName(), nfe); } } | SourceResource extends BaseResourceWithAllocator { @RolesAllowed("admin") @DELETE @Produces(MediaType.APPLICATION_JSON) public void deleteSource(@QueryParam("version") String version) throws NamespaceException, SourceNotFoundException { if (version == null) { throw new ClientErrorException("missing version parameter"); } try { SourceConfig config = namespaceService.getSource(new SourcePath(sourceName).toNamespaceKey()); if(!Objects.equals(config.getTag(), version)) { throw new ConcurrentModificationException(String.format("Unable to delete source, expected version %s, received version %s.", config.getTag(), version)); } sourceCatalog.deleteSource(config); } catch (NamespaceNotFoundException nfe) { throw new SourceNotFoundException(sourcePath.getSourceName().getName(), nfe); } } } | SourceResource extends BaseResourceWithAllocator { @RolesAllowed("admin") @DELETE @Produces(MediaType.APPLICATION_JSON) public void deleteSource(@QueryParam("version") String version) throws NamespaceException, SourceNotFoundException { if (version == null) { throw new ClientErrorException("missing version parameter"); } try { SourceConfig config = namespaceService.getSource(new SourcePath(sourceName).toNamespaceKey()); if(!Objects.equals(config.getTag(), version)) { throw new ConcurrentModificationException(String.format("Unable to delete source, expected version %s, received version %s.", config.getTag(), version)); } sourceCatalog.deleteSource(config); } catch (NamespaceNotFoundException nfe) { throw new SourceNotFoundException(sourcePath.getSourceName().getName(), nfe); } } @Inject SourceResource(
NamespaceService namespaceService,
ReflectionAdministrationService.Factory reflectionService,
SourceService sourceService,
@PathParam("sourceName") SourceName sourceName,
QueryExecutor executor,
SecurityContext securityContext,
DatasetsResource datasetsResource,
ConnectionReader cReader,
SourceCatalog sourceCatalog,
FormatTools formatTools,
ContextService context,
BufferAllocatorFactory allocatorFactory
); } | SourceResource extends BaseResourceWithAllocator { @RolesAllowed("admin") @DELETE @Produces(MediaType.APPLICATION_JSON) public void deleteSource(@QueryParam("version") String version) throws NamespaceException, SourceNotFoundException { if (version == null) { throw new ClientErrorException("missing version parameter"); } try { SourceConfig config = namespaceService.getSource(new SourcePath(sourceName).toNamespaceKey()); if(!Objects.equals(config.getTag(), version)) { throw new ConcurrentModificationException(String.format("Unable to delete source, expected version %s, received version %s.", config.getTag(), version)); } sourceCatalog.deleteSource(config); } catch (NamespaceNotFoundException nfe) { throw new SourceNotFoundException(sourcePath.getSourceName().getName(), nfe); } } @Inject SourceResource(
NamespaceService namespaceService,
ReflectionAdministrationService.Factory reflectionService,
SourceService sourceService,
@PathParam("sourceName") SourceName sourceName,
QueryExecutor executor,
SecurityContext securityContext,
DatasetsResource datasetsResource,
ConnectionReader cReader,
SourceCatalog sourceCatalog,
FormatTools formatTools,
ContextService context,
BufferAllocatorFactory allocatorFactory
); @GET @Produces(MediaType.APPLICATION_JSON) SourceUI getSource(@QueryParam("includeContents") @DefaultValue("true") boolean includeContents); @RolesAllowed("admin") @DELETE @Produces(MediaType.APPLICATION_JSON) void deleteSource(@QueryParam("version") String version); @GET @Path("/folder/{path: .*}") @Produces(MediaType.APPLICATION_JSON) Folder getFolder(@PathParam("path") String path, @QueryParam("includeContents") @DefaultValue("true") boolean includeContents); @GET @Path("/dataset/{path: .*}") @Produces(MediaType.APPLICATION_JSON) PhysicalDataset getPhysicalDataset(@PathParam("path") String path); @GET @Path("/file/{path: .*}") @Produces(MediaType.APPLICATION_JSON) File getFile(@PathParam("path") String path); @GET @Path("/file_format/{path: .*}") @Produces(MediaType.APPLICATION_JSON) FileFormatUI getFileFormatSettings(@PathParam("path") String path); @PUT @Path("/file_format/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) FileFormatUI saveFormatSettings(FileFormat fileFormat, @PathParam("path") String path); @POST @Path("/file_preview/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) JobDataFragment previewFileFormat(FileFormat format, @PathParam("path") String path); @POST @Path("/folder_preview/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) JobDataFragment previewFolderFormat(FileFormat format, @PathParam("path") String path); @DELETE @Path("/file_format/{path: .*}") void deleteFileFormat(@PathParam("path") String path,
@QueryParam("version") String version); @GET @Path("/folder_format/{path: .*}") @Produces(MediaType.APPLICATION_JSON) FileFormatUI getFolderFormat(@PathParam("path") String path); @PUT @Path("/folder_format/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) FileFormatUI saveFolderFormat(FileFormat fileFormat, @PathParam("path") String path); @DELETE @Path("/folder_format/{path: .*}") @Produces(MediaType.APPLICATION_JSON) void deleteFolderFormat(@PathParam("path") String path,
@QueryParam("version") String version); @POST @Path("new_untitled_from_file/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) InitialPreviewResponse createUntitledFromSourceFile(
@PathParam("path") String path,
@QueryParam("limit") Integer limit); @POST @Path("new_untitled_from_folder/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) InitialPreviewResponse createUntitledFromSourceFolder(
@PathParam("path") String path,
@QueryParam("limit") Integer limit); @POST @Path("new_untitled_from_physical_dataset/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) InitialPreviewResponse createUntitledFromPhysicalDataset(
@PathParam("path") String path,
@QueryParam("limit") Integer limit); } | SourceResource extends BaseResourceWithAllocator { @RolesAllowed("admin") @DELETE @Produces(MediaType.APPLICATION_JSON) public void deleteSource(@QueryParam("version") String version) throws NamespaceException, SourceNotFoundException { if (version == null) { throw new ClientErrorException("missing version parameter"); } try { SourceConfig config = namespaceService.getSource(new SourcePath(sourceName).toNamespaceKey()); if(!Objects.equals(config.getTag(), version)) { throw new ConcurrentModificationException(String.format("Unable to delete source, expected version %s, received version %s.", config.getTag(), version)); } sourceCatalog.deleteSource(config); } catch (NamespaceNotFoundException nfe) { throw new SourceNotFoundException(sourcePath.getSourceName().getName(), nfe); } } @Inject SourceResource(
NamespaceService namespaceService,
ReflectionAdministrationService.Factory reflectionService,
SourceService sourceService,
@PathParam("sourceName") SourceName sourceName,
QueryExecutor executor,
SecurityContext securityContext,
DatasetsResource datasetsResource,
ConnectionReader cReader,
SourceCatalog sourceCatalog,
FormatTools formatTools,
ContextService context,
BufferAllocatorFactory allocatorFactory
); @GET @Produces(MediaType.APPLICATION_JSON) SourceUI getSource(@QueryParam("includeContents") @DefaultValue("true") boolean includeContents); @RolesAllowed("admin") @DELETE @Produces(MediaType.APPLICATION_JSON) void deleteSource(@QueryParam("version") String version); @GET @Path("/folder/{path: .*}") @Produces(MediaType.APPLICATION_JSON) Folder getFolder(@PathParam("path") String path, @QueryParam("includeContents") @DefaultValue("true") boolean includeContents); @GET @Path("/dataset/{path: .*}") @Produces(MediaType.APPLICATION_JSON) PhysicalDataset getPhysicalDataset(@PathParam("path") String path); @GET @Path("/file/{path: .*}") @Produces(MediaType.APPLICATION_JSON) File getFile(@PathParam("path") String path); @GET @Path("/file_format/{path: .*}") @Produces(MediaType.APPLICATION_JSON) FileFormatUI getFileFormatSettings(@PathParam("path") String path); @PUT @Path("/file_format/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) FileFormatUI saveFormatSettings(FileFormat fileFormat, @PathParam("path") String path); @POST @Path("/file_preview/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) JobDataFragment previewFileFormat(FileFormat format, @PathParam("path") String path); @POST @Path("/folder_preview/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) JobDataFragment previewFolderFormat(FileFormat format, @PathParam("path") String path); @DELETE @Path("/file_format/{path: .*}") void deleteFileFormat(@PathParam("path") String path,
@QueryParam("version") String version); @GET @Path("/folder_format/{path: .*}") @Produces(MediaType.APPLICATION_JSON) FileFormatUI getFolderFormat(@PathParam("path") String path); @PUT @Path("/folder_format/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) FileFormatUI saveFolderFormat(FileFormat fileFormat, @PathParam("path") String path); @DELETE @Path("/folder_format/{path: .*}") @Produces(MediaType.APPLICATION_JSON) void deleteFolderFormat(@PathParam("path") String path,
@QueryParam("version") String version); @POST @Path("new_untitled_from_file/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) InitialPreviewResponse createUntitledFromSourceFile(
@PathParam("path") String path,
@QueryParam("limit") Integer limit); @POST @Path("new_untitled_from_folder/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) InitialPreviewResponse createUntitledFromSourceFolder(
@PathParam("path") String path,
@QueryParam("limit") Integer limit); @POST @Path("new_untitled_from_physical_dataset/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) InitialPreviewResponse createUntitledFromPhysicalDataset(
@PathParam("path") String path,
@QueryParam("limit") Integer limit); } |
@Test public void testSourceHasDefaultTTL() throws Exception { final String sourceName = "src2"; final NASConf nas = new NASConf(); nas.path = folder.getRoot().getPath(); SourceUI source = new SourceUI(); source.setName(sourceName); source.setCtime(System.currentTimeMillis()); source.setConfig(nas); source.setAllowCrossSourceSelection(true); expectSuccess( getBuilder(getAPIv2().path(String.format("/source/%s", sourceName))) .buildPut(Entity.entity(source, JSON))); final SourceUI result = expectSuccess( getBuilder(getAPIv2().path(String.format("/source/%s", sourceName))).buildGet(), SourceUI.class ); assertEquals(source.getFullPathList(), result.getFullPathList()); assertNotNull(result.getAccelerationRefreshPeriod()); assertNotNull(result.getAccelerationGracePeriod()); assertTrue(result.getAllowCrossSourceSelection()); newNamespaceService().deleteSource(new SourcePath(sourceName).toNamespaceKey(), result.getTag()); } | @RolesAllowed("admin") @DELETE @Produces(MediaType.APPLICATION_JSON) public void deleteSource(@QueryParam("version") String version) throws NamespaceException, SourceNotFoundException { if (version == null) { throw new ClientErrorException("missing version parameter"); } try { SourceConfig config = namespaceService.getSource(new SourcePath(sourceName).toNamespaceKey()); if(!Objects.equals(config.getTag(), version)) { throw new ConcurrentModificationException(String.format("Unable to delete source, expected version %s, received version %s.", config.getTag(), version)); } sourceCatalog.deleteSource(config); } catch (NamespaceNotFoundException nfe) { throw new SourceNotFoundException(sourcePath.getSourceName().getName(), nfe); } } | SourceResource extends BaseResourceWithAllocator { @RolesAllowed("admin") @DELETE @Produces(MediaType.APPLICATION_JSON) public void deleteSource(@QueryParam("version") String version) throws NamespaceException, SourceNotFoundException { if (version == null) { throw new ClientErrorException("missing version parameter"); } try { SourceConfig config = namespaceService.getSource(new SourcePath(sourceName).toNamespaceKey()); if(!Objects.equals(config.getTag(), version)) { throw new ConcurrentModificationException(String.format("Unable to delete source, expected version %s, received version %s.", config.getTag(), version)); } sourceCatalog.deleteSource(config); } catch (NamespaceNotFoundException nfe) { throw new SourceNotFoundException(sourcePath.getSourceName().getName(), nfe); } } } | SourceResource extends BaseResourceWithAllocator { @RolesAllowed("admin") @DELETE @Produces(MediaType.APPLICATION_JSON) public void deleteSource(@QueryParam("version") String version) throws NamespaceException, SourceNotFoundException { if (version == null) { throw new ClientErrorException("missing version parameter"); } try { SourceConfig config = namespaceService.getSource(new SourcePath(sourceName).toNamespaceKey()); if(!Objects.equals(config.getTag(), version)) { throw new ConcurrentModificationException(String.format("Unable to delete source, expected version %s, received version %s.", config.getTag(), version)); } sourceCatalog.deleteSource(config); } catch (NamespaceNotFoundException nfe) { throw new SourceNotFoundException(sourcePath.getSourceName().getName(), nfe); } } @Inject SourceResource(
NamespaceService namespaceService,
ReflectionAdministrationService.Factory reflectionService,
SourceService sourceService,
@PathParam("sourceName") SourceName sourceName,
QueryExecutor executor,
SecurityContext securityContext,
DatasetsResource datasetsResource,
ConnectionReader cReader,
SourceCatalog sourceCatalog,
FormatTools formatTools,
ContextService context,
BufferAllocatorFactory allocatorFactory
); } | SourceResource extends BaseResourceWithAllocator { @RolesAllowed("admin") @DELETE @Produces(MediaType.APPLICATION_JSON) public void deleteSource(@QueryParam("version") String version) throws NamespaceException, SourceNotFoundException { if (version == null) { throw new ClientErrorException("missing version parameter"); } try { SourceConfig config = namespaceService.getSource(new SourcePath(sourceName).toNamespaceKey()); if(!Objects.equals(config.getTag(), version)) { throw new ConcurrentModificationException(String.format("Unable to delete source, expected version %s, received version %s.", config.getTag(), version)); } sourceCatalog.deleteSource(config); } catch (NamespaceNotFoundException nfe) { throw new SourceNotFoundException(sourcePath.getSourceName().getName(), nfe); } } @Inject SourceResource(
NamespaceService namespaceService,
ReflectionAdministrationService.Factory reflectionService,
SourceService sourceService,
@PathParam("sourceName") SourceName sourceName,
QueryExecutor executor,
SecurityContext securityContext,
DatasetsResource datasetsResource,
ConnectionReader cReader,
SourceCatalog sourceCatalog,
FormatTools formatTools,
ContextService context,
BufferAllocatorFactory allocatorFactory
); @GET @Produces(MediaType.APPLICATION_JSON) SourceUI getSource(@QueryParam("includeContents") @DefaultValue("true") boolean includeContents); @RolesAllowed("admin") @DELETE @Produces(MediaType.APPLICATION_JSON) void deleteSource(@QueryParam("version") String version); @GET @Path("/folder/{path: .*}") @Produces(MediaType.APPLICATION_JSON) Folder getFolder(@PathParam("path") String path, @QueryParam("includeContents") @DefaultValue("true") boolean includeContents); @GET @Path("/dataset/{path: .*}") @Produces(MediaType.APPLICATION_JSON) PhysicalDataset getPhysicalDataset(@PathParam("path") String path); @GET @Path("/file/{path: .*}") @Produces(MediaType.APPLICATION_JSON) File getFile(@PathParam("path") String path); @GET @Path("/file_format/{path: .*}") @Produces(MediaType.APPLICATION_JSON) FileFormatUI getFileFormatSettings(@PathParam("path") String path); @PUT @Path("/file_format/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) FileFormatUI saveFormatSettings(FileFormat fileFormat, @PathParam("path") String path); @POST @Path("/file_preview/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) JobDataFragment previewFileFormat(FileFormat format, @PathParam("path") String path); @POST @Path("/folder_preview/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) JobDataFragment previewFolderFormat(FileFormat format, @PathParam("path") String path); @DELETE @Path("/file_format/{path: .*}") void deleteFileFormat(@PathParam("path") String path,
@QueryParam("version") String version); @GET @Path("/folder_format/{path: .*}") @Produces(MediaType.APPLICATION_JSON) FileFormatUI getFolderFormat(@PathParam("path") String path); @PUT @Path("/folder_format/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) FileFormatUI saveFolderFormat(FileFormat fileFormat, @PathParam("path") String path); @DELETE @Path("/folder_format/{path: .*}") @Produces(MediaType.APPLICATION_JSON) void deleteFolderFormat(@PathParam("path") String path,
@QueryParam("version") String version); @POST @Path("new_untitled_from_file/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) InitialPreviewResponse createUntitledFromSourceFile(
@PathParam("path") String path,
@QueryParam("limit") Integer limit); @POST @Path("new_untitled_from_folder/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) InitialPreviewResponse createUntitledFromSourceFolder(
@PathParam("path") String path,
@QueryParam("limit") Integer limit); @POST @Path("new_untitled_from_physical_dataset/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) InitialPreviewResponse createUntitledFromPhysicalDataset(
@PathParam("path") String path,
@QueryParam("limit") Integer limit); } | SourceResource extends BaseResourceWithAllocator { @RolesAllowed("admin") @DELETE @Produces(MediaType.APPLICATION_JSON) public void deleteSource(@QueryParam("version") String version) throws NamespaceException, SourceNotFoundException { if (version == null) { throw new ClientErrorException("missing version parameter"); } try { SourceConfig config = namespaceService.getSource(new SourcePath(sourceName).toNamespaceKey()); if(!Objects.equals(config.getTag(), version)) { throw new ConcurrentModificationException(String.format("Unable to delete source, expected version %s, received version %s.", config.getTag(), version)); } sourceCatalog.deleteSource(config); } catch (NamespaceNotFoundException nfe) { throw new SourceNotFoundException(sourcePath.getSourceName().getName(), nfe); } } @Inject SourceResource(
NamespaceService namespaceService,
ReflectionAdministrationService.Factory reflectionService,
SourceService sourceService,
@PathParam("sourceName") SourceName sourceName,
QueryExecutor executor,
SecurityContext securityContext,
DatasetsResource datasetsResource,
ConnectionReader cReader,
SourceCatalog sourceCatalog,
FormatTools formatTools,
ContextService context,
BufferAllocatorFactory allocatorFactory
); @GET @Produces(MediaType.APPLICATION_JSON) SourceUI getSource(@QueryParam("includeContents") @DefaultValue("true") boolean includeContents); @RolesAllowed("admin") @DELETE @Produces(MediaType.APPLICATION_JSON) void deleteSource(@QueryParam("version") String version); @GET @Path("/folder/{path: .*}") @Produces(MediaType.APPLICATION_JSON) Folder getFolder(@PathParam("path") String path, @QueryParam("includeContents") @DefaultValue("true") boolean includeContents); @GET @Path("/dataset/{path: .*}") @Produces(MediaType.APPLICATION_JSON) PhysicalDataset getPhysicalDataset(@PathParam("path") String path); @GET @Path("/file/{path: .*}") @Produces(MediaType.APPLICATION_JSON) File getFile(@PathParam("path") String path); @GET @Path("/file_format/{path: .*}") @Produces(MediaType.APPLICATION_JSON) FileFormatUI getFileFormatSettings(@PathParam("path") String path); @PUT @Path("/file_format/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) FileFormatUI saveFormatSettings(FileFormat fileFormat, @PathParam("path") String path); @POST @Path("/file_preview/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) JobDataFragment previewFileFormat(FileFormat format, @PathParam("path") String path); @POST @Path("/folder_preview/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) JobDataFragment previewFolderFormat(FileFormat format, @PathParam("path") String path); @DELETE @Path("/file_format/{path: .*}") void deleteFileFormat(@PathParam("path") String path,
@QueryParam("version") String version); @GET @Path("/folder_format/{path: .*}") @Produces(MediaType.APPLICATION_JSON) FileFormatUI getFolderFormat(@PathParam("path") String path); @PUT @Path("/folder_format/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) FileFormatUI saveFolderFormat(FileFormat fileFormat, @PathParam("path") String path); @DELETE @Path("/folder_format/{path: .*}") @Produces(MediaType.APPLICATION_JSON) void deleteFolderFormat(@PathParam("path") String path,
@QueryParam("version") String version); @POST @Path("new_untitled_from_file/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) InitialPreviewResponse createUntitledFromSourceFile(
@PathParam("path") String path,
@QueryParam("limit") Integer limit); @POST @Path("new_untitled_from_folder/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) InitialPreviewResponse createUntitledFromSourceFolder(
@PathParam("path") String path,
@QueryParam("limit") Integer limit); @POST @Path("new_untitled_from_physical_dataset/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) InitialPreviewResponse createUntitledFromPhysicalDataset(
@PathParam("path") String path,
@QueryParam("limit") Integer limit); } |
@Test public void testSourceHasDefaultRefreshPolicy() throws Exception { final String sourceName = "src3"; final NASConf nas = new NASConf(); nas.path = folder.getRoot().getPath() ; SourceUI source = new SourceUI(); source.setName(sourceName); source.setCtime(System.currentTimeMillis()); source.setConfig(nas); expectSuccess( getBuilder(getAPIv2().path(String.format("/source/%s", sourceName))) .buildPut(Entity.entity(source, JSON))); final SourceUI result = expectSuccess( getBuilder(getAPIv2().path(String.format("/source/%s", sourceName))).buildGet(), SourceUI.class ); assertEquals(source.getFullPathList(), result.getFullPathList()); assertNotNull(source.getMetadataPolicy()); assertEquals(CatalogService.DEFAULT_AUTHTTLS_MILLIS, result.getMetadataPolicy().getAuthTTLMillis()); assertEquals(CatalogService.DEFAULT_REFRESH_MILLIS, result.getMetadataPolicy().getNamesRefreshMillis()); assertEquals(CatalogService.DEFAULT_REFRESH_MILLIS, result.getMetadataPolicy().getDatasetDefinitionRefreshAfterMillis()); assertEquals(CatalogService.DEFAULT_EXPIRE_MILLIS, result.getMetadataPolicy().getDatasetDefinitionExpireAfterMillis()); newNamespaceService().deleteSource(new SourcePath(sourceName).toNamespaceKey(), result.getTag()); } | @RolesAllowed("admin") @DELETE @Produces(MediaType.APPLICATION_JSON) public void deleteSource(@QueryParam("version") String version) throws NamespaceException, SourceNotFoundException { if (version == null) { throw new ClientErrorException("missing version parameter"); } try { SourceConfig config = namespaceService.getSource(new SourcePath(sourceName).toNamespaceKey()); if(!Objects.equals(config.getTag(), version)) { throw new ConcurrentModificationException(String.format("Unable to delete source, expected version %s, received version %s.", config.getTag(), version)); } sourceCatalog.deleteSource(config); } catch (NamespaceNotFoundException nfe) { throw new SourceNotFoundException(sourcePath.getSourceName().getName(), nfe); } } | SourceResource extends BaseResourceWithAllocator { @RolesAllowed("admin") @DELETE @Produces(MediaType.APPLICATION_JSON) public void deleteSource(@QueryParam("version") String version) throws NamespaceException, SourceNotFoundException { if (version == null) { throw new ClientErrorException("missing version parameter"); } try { SourceConfig config = namespaceService.getSource(new SourcePath(sourceName).toNamespaceKey()); if(!Objects.equals(config.getTag(), version)) { throw new ConcurrentModificationException(String.format("Unable to delete source, expected version %s, received version %s.", config.getTag(), version)); } sourceCatalog.deleteSource(config); } catch (NamespaceNotFoundException nfe) { throw new SourceNotFoundException(sourcePath.getSourceName().getName(), nfe); } } } | SourceResource extends BaseResourceWithAllocator { @RolesAllowed("admin") @DELETE @Produces(MediaType.APPLICATION_JSON) public void deleteSource(@QueryParam("version") String version) throws NamespaceException, SourceNotFoundException { if (version == null) { throw new ClientErrorException("missing version parameter"); } try { SourceConfig config = namespaceService.getSource(new SourcePath(sourceName).toNamespaceKey()); if(!Objects.equals(config.getTag(), version)) { throw new ConcurrentModificationException(String.format("Unable to delete source, expected version %s, received version %s.", config.getTag(), version)); } sourceCatalog.deleteSource(config); } catch (NamespaceNotFoundException nfe) { throw new SourceNotFoundException(sourcePath.getSourceName().getName(), nfe); } } @Inject SourceResource(
NamespaceService namespaceService,
ReflectionAdministrationService.Factory reflectionService,
SourceService sourceService,
@PathParam("sourceName") SourceName sourceName,
QueryExecutor executor,
SecurityContext securityContext,
DatasetsResource datasetsResource,
ConnectionReader cReader,
SourceCatalog sourceCatalog,
FormatTools formatTools,
ContextService context,
BufferAllocatorFactory allocatorFactory
); } | SourceResource extends BaseResourceWithAllocator { @RolesAllowed("admin") @DELETE @Produces(MediaType.APPLICATION_JSON) public void deleteSource(@QueryParam("version") String version) throws NamespaceException, SourceNotFoundException { if (version == null) { throw new ClientErrorException("missing version parameter"); } try { SourceConfig config = namespaceService.getSource(new SourcePath(sourceName).toNamespaceKey()); if(!Objects.equals(config.getTag(), version)) { throw new ConcurrentModificationException(String.format("Unable to delete source, expected version %s, received version %s.", config.getTag(), version)); } sourceCatalog.deleteSource(config); } catch (NamespaceNotFoundException nfe) { throw new SourceNotFoundException(sourcePath.getSourceName().getName(), nfe); } } @Inject SourceResource(
NamespaceService namespaceService,
ReflectionAdministrationService.Factory reflectionService,
SourceService sourceService,
@PathParam("sourceName") SourceName sourceName,
QueryExecutor executor,
SecurityContext securityContext,
DatasetsResource datasetsResource,
ConnectionReader cReader,
SourceCatalog sourceCatalog,
FormatTools formatTools,
ContextService context,
BufferAllocatorFactory allocatorFactory
); @GET @Produces(MediaType.APPLICATION_JSON) SourceUI getSource(@QueryParam("includeContents") @DefaultValue("true") boolean includeContents); @RolesAllowed("admin") @DELETE @Produces(MediaType.APPLICATION_JSON) void deleteSource(@QueryParam("version") String version); @GET @Path("/folder/{path: .*}") @Produces(MediaType.APPLICATION_JSON) Folder getFolder(@PathParam("path") String path, @QueryParam("includeContents") @DefaultValue("true") boolean includeContents); @GET @Path("/dataset/{path: .*}") @Produces(MediaType.APPLICATION_JSON) PhysicalDataset getPhysicalDataset(@PathParam("path") String path); @GET @Path("/file/{path: .*}") @Produces(MediaType.APPLICATION_JSON) File getFile(@PathParam("path") String path); @GET @Path("/file_format/{path: .*}") @Produces(MediaType.APPLICATION_JSON) FileFormatUI getFileFormatSettings(@PathParam("path") String path); @PUT @Path("/file_format/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) FileFormatUI saveFormatSettings(FileFormat fileFormat, @PathParam("path") String path); @POST @Path("/file_preview/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) JobDataFragment previewFileFormat(FileFormat format, @PathParam("path") String path); @POST @Path("/folder_preview/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) JobDataFragment previewFolderFormat(FileFormat format, @PathParam("path") String path); @DELETE @Path("/file_format/{path: .*}") void deleteFileFormat(@PathParam("path") String path,
@QueryParam("version") String version); @GET @Path("/folder_format/{path: .*}") @Produces(MediaType.APPLICATION_JSON) FileFormatUI getFolderFormat(@PathParam("path") String path); @PUT @Path("/folder_format/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) FileFormatUI saveFolderFormat(FileFormat fileFormat, @PathParam("path") String path); @DELETE @Path("/folder_format/{path: .*}") @Produces(MediaType.APPLICATION_JSON) void deleteFolderFormat(@PathParam("path") String path,
@QueryParam("version") String version); @POST @Path("new_untitled_from_file/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) InitialPreviewResponse createUntitledFromSourceFile(
@PathParam("path") String path,
@QueryParam("limit") Integer limit); @POST @Path("new_untitled_from_folder/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) InitialPreviewResponse createUntitledFromSourceFolder(
@PathParam("path") String path,
@QueryParam("limit") Integer limit); @POST @Path("new_untitled_from_physical_dataset/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) InitialPreviewResponse createUntitledFromPhysicalDataset(
@PathParam("path") String path,
@QueryParam("limit") Integer limit); } | SourceResource extends BaseResourceWithAllocator { @RolesAllowed("admin") @DELETE @Produces(MediaType.APPLICATION_JSON) public void deleteSource(@QueryParam("version") String version) throws NamespaceException, SourceNotFoundException { if (version == null) { throw new ClientErrorException("missing version parameter"); } try { SourceConfig config = namespaceService.getSource(new SourcePath(sourceName).toNamespaceKey()); if(!Objects.equals(config.getTag(), version)) { throw new ConcurrentModificationException(String.format("Unable to delete source, expected version %s, received version %s.", config.getTag(), version)); } sourceCatalog.deleteSource(config); } catch (NamespaceNotFoundException nfe) { throw new SourceNotFoundException(sourcePath.getSourceName().getName(), nfe); } } @Inject SourceResource(
NamespaceService namespaceService,
ReflectionAdministrationService.Factory reflectionService,
SourceService sourceService,
@PathParam("sourceName") SourceName sourceName,
QueryExecutor executor,
SecurityContext securityContext,
DatasetsResource datasetsResource,
ConnectionReader cReader,
SourceCatalog sourceCatalog,
FormatTools formatTools,
ContextService context,
BufferAllocatorFactory allocatorFactory
); @GET @Produces(MediaType.APPLICATION_JSON) SourceUI getSource(@QueryParam("includeContents") @DefaultValue("true") boolean includeContents); @RolesAllowed("admin") @DELETE @Produces(MediaType.APPLICATION_JSON) void deleteSource(@QueryParam("version") String version); @GET @Path("/folder/{path: .*}") @Produces(MediaType.APPLICATION_JSON) Folder getFolder(@PathParam("path") String path, @QueryParam("includeContents") @DefaultValue("true") boolean includeContents); @GET @Path("/dataset/{path: .*}") @Produces(MediaType.APPLICATION_JSON) PhysicalDataset getPhysicalDataset(@PathParam("path") String path); @GET @Path("/file/{path: .*}") @Produces(MediaType.APPLICATION_JSON) File getFile(@PathParam("path") String path); @GET @Path("/file_format/{path: .*}") @Produces(MediaType.APPLICATION_JSON) FileFormatUI getFileFormatSettings(@PathParam("path") String path); @PUT @Path("/file_format/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) FileFormatUI saveFormatSettings(FileFormat fileFormat, @PathParam("path") String path); @POST @Path("/file_preview/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) JobDataFragment previewFileFormat(FileFormat format, @PathParam("path") String path); @POST @Path("/folder_preview/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) JobDataFragment previewFolderFormat(FileFormat format, @PathParam("path") String path); @DELETE @Path("/file_format/{path: .*}") void deleteFileFormat(@PathParam("path") String path,
@QueryParam("version") String version); @GET @Path("/folder_format/{path: .*}") @Produces(MediaType.APPLICATION_JSON) FileFormatUI getFolderFormat(@PathParam("path") String path); @PUT @Path("/folder_format/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) FileFormatUI saveFolderFormat(FileFormat fileFormat, @PathParam("path") String path); @DELETE @Path("/folder_format/{path: .*}") @Produces(MediaType.APPLICATION_JSON) void deleteFolderFormat(@PathParam("path") String path,
@QueryParam("version") String version); @POST @Path("new_untitled_from_file/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) InitialPreviewResponse createUntitledFromSourceFile(
@PathParam("path") String path,
@QueryParam("limit") Integer limit); @POST @Path("new_untitled_from_folder/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) InitialPreviewResponse createUntitledFromSourceFolder(
@PathParam("path") String path,
@QueryParam("limit") Integer limit); @POST @Path("new_untitled_from_physical_dataset/{path: .*}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) InitialPreviewResponse createUntitledFromPhysicalDataset(
@PathParam("path") String path,
@QueryParam("limit") Integer limit); } |
@Test public void verifyHeaders() { final Response response = resource.buildResponseWithHost(Response.ok(), inputHost).build(); if (expectedHost == null) { assertFalse(response.getHeaders().containsKey(WebServer.X_DREMIO_HOSTNAME)); return; } assertEquals(expectedHost, response.getHeaders().get(WebServer.X_DREMIO_HOSTNAME).get(0)); } | @VisibleForTesting Response.ResponseBuilder buildResponseWithHost(Response.ResponseBuilder builder, String host) { if (host == null) { return builder; } final String hostOnly; final int portIndex = host.indexOf(":"); if (portIndex == -1) { hostOnly = host; } else { hostOnly = host.substring(0, portIndex); } return builder.header(WebServer.X_DREMIO_HOSTNAME, hostOnly); } | BaseBIToolResource { @VisibleForTesting Response.ResponseBuilder buildResponseWithHost(Response.ResponseBuilder builder, String host) { if (host == null) { return builder; } final String hostOnly; final int portIndex = host.indexOf(":"); if (portIndex == -1) { hostOnly = host; } else { hostOnly = host.substring(0, portIndex); } return builder.header(WebServer.X_DREMIO_HOSTNAME, hostOnly); } } | BaseBIToolResource { @VisibleForTesting Response.ResponseBuilder buildResponseWithHost(Response.ResponseBuilder builder, String host) { if (host == null) { return builder; } final String hostOnly; final int portIndex = host.indexOf(":"); if (portIndex == -1) { hostOnly = host; } else { hostOnly = host.substring(0, portIndex); } return builder.header(WebServer.X_DREMIO_HOSTNAME, hostOnly); } protected BaseBIToolResource(NamespaceService namespace, ProjectOptionManager optionManager, String datasetId); } | BaseBIToolResource { @VisibleForTesting Response.ResponseBuilder buildResponseWithHost(Response.ResponseBuilder builder, String host) { if (host == null) { return builder; } final String hostOnly; final int portIndex = host.indexOf(":"); if (portIndex == -1) { hostOnly = host; } else { hostOnly = host.substring(0, portIndex); } return builder.header(WebServer.X_DREMIO_HOSTNAME, hostOnly); } protected BaseBIToolResource(NamespaceService namespace, ProjectOptionManager optionManager, String datasetId); } | BaseBIToolResource { @VisibleForTesting Response.ResponseBuilder buildResponseWithHost(Response.ResponseBuilder builder, String host) { if (host == null) { return builder; } final String hostOnly; final int portIndex = host.indexOf(":"); if (portIndex == -1) { hostOnly = host; } else { hostOnly = host.substring(0, portIndex); } return builder.header(WebServer.X_DREMIO_HOSTNAME, hostOnly); } protected BaseBIToolResource(NamespaceService namespace, ProjectOptionManager optionManager, String datasetId); } |
@Test public void testCreateReflection() { Reflection newReflection = createReflection(); Reflection response = expectSuccess(getBuilder(getPublicAPI(3).path(REFLECTIONS_PATH)).buildPost(Entity.entity(newReflection, JSON)), Reflection.class); assertEquals(response.getDatasetId(), newReflection.getDatasetId()); assertEquals(response.getName(), newReflection.getName()); assertEquals(response.getType(), newReflection.getType()); assertEquals(response.isEnabled(), newReflection.isEnabled()); assertNotNull(response.getCreatedAt()); assertNotNull(response.getUpdatedAt()); assertNotNull(response.getStatus()); assertNotNull(response.getTag()); assertNotNull(response.getId()); assertEquals(response.getDisplayFields(), newReflection.getDisplayFields()); assertNull(response.getDimensionFields()); assertNull(response.getDistributionFields()); assertNull(response.getMeasureFields()); assertNull(response.getPartitionFields()); assertNull(response.getSortFields()); assertEquals(response.getPartitionDistributionStrategy(), newReflection.getPartitionDistributionStrategy()); newReflectionServiceHelper().removeReflection(response.getId()); } | @POST public Reflection createReflection(Reflection reflection) { ReflectionGoal newReflection = reflectionServiceHelper.createReflection(reflection.toReflectionGoal()); String id = newReflection.getId().getId(); return new Reflection(newReflection, reflectionServiceHelper.getStatusForReflection(id), reflectionServiceHelper.getCurrentSize(id), reflectionServiceHelper.getTotalSize(id)); } | ReflectionResource { @POST public Reflection createReflection(Reflection reflection) { ReflectionGoal newReflection = reflectionServiceHelper.createReflection(reflection.toReflectionGoal()); String id = newReflection.getId().getId(); return new Reflection(newReflection, reflectionServiceHelper.getStatusForReflection(id), reflectionServiceHelper.getCurrentSize(id), reflectionServiceHelper.getTotalSize(id)); } } | ReflectionResource { @POST public Reflection createReflection(Reflection reflection) { ReflectionGoal newReflection = reflectionServiceHelper.createReflection(reflection.toReflectionGoal()); String id = newReflection.getId().getId(); return new Reflection(newReflection, reflectionServiceHelper.getStatusForReflection(id), reflectionServiceHelper.getCurrentSize(id), reflectionServiceHelper.getTotalSize(id)); } @Inject ReflectionResource(ReflectionServiceHelper reflectionServiceHelper, CatalogServiceHelper catalogServiceHelper); } | ReflectionResource { @POST public Reflection createReflection(Reflection reflection) { ReflectionGoal newReflection = reflectionServiceHelper.createReflection(reflection.toReflectionGoal()); String id = newReflection.getId().getId(); return new Reflection(newReflection, reflectionServiceHelper.getStatusForReflection(id), reflectionServiceHelper.getCurrentSize(id), reflectionServiceHelper.getTotalSize(id)); } @Inject ReflectionResource(ReflectionServiceHelper reflectionServiceHelper, CatalogServiceHelper catalogServiceHelper); @GET @Path("/{id}") Reflection getReflection(@PathParam("id") String id); @POST Reflection createReflection(Reflection reflection); @PUT @Path("/{id}") Reflection editReflection(@PathParam("id") String id, Reflection reflection); @DELETE @Path("/{id}") Response deleteReflection(@PathParam("id") String id); } | ReflectionResource { @POST public Reflection createReflection(Reflection reflection) { ReflectionGoal newReflection = reflectionServiceHelper.createReflection(reflection.toReflectionGoal()); String id = newReflection.getId().getId(); return new Reflection(newReflection, reflectionServiceHelper.getStatusForReflection(id), reflectionServiceHelper.getCurrentSize(id), reflectionServiceHelper.getTotalSize(id)); } @Inject ReflectionResource(ReflectionServiceHelper reflectionServiceHelper, CatalogServiceHelper catalogServiceHelper); @GET @Path("/{id}") Reflection getReflection(@PathParam("id") String id); @POST Reflection createReflection(Reflection reflection); @PUT @Path("/{id}") Reflection editReflection(@PathParam("id") String id, Reflection reflection); @DELETE @Path("/{id}") Response deleteReflection(@PathParam("id") String id); } |
@Test public void testGetReflection() { Reflection newReflection = createReflection(); Reflection response = expectSuccess(getBuilder(getPublicAPI(3).path(REFLECTIONS_PATH)).buildPost(Entity.entity(newReflection, JSON)), Reflection.class); Reflection response2 = expectSuccess(getBuilder(getPublicAPI(3).path(REFLECTIONS_PATH).path(response.getId())).buildGet(), Reflection.class); assertEquals(response2.getId(), response.getId()); assertEquals(response2.getName(), response.getName()); assertEquals(response2.getType(), response.getType()); assertEquals(response2.getCreatedAt(), response.getCreatedAt()); assertEquals(response2.getUpdatedAt(), response.getUpdatedAt()); assertEquals(response2.getTag(), response.getTag()); assertEquals(response2.getDisplayFields(), response.getDisplayFields()); assertEquals(response2.getDimensionFields(), response.getDimensionFields()); assertEquals(response2.getDistributionFields(), response.getDistributionFields()); assertEquals(response2.getMeasureFields(), response.getMeasureFields()); assertEquals(response2.getPartitionFields(), response.getPartitionFields()); assertEquals(response2.getSortFields(), response.getSortFields()); assertEquals(response2.getPartitionDistributionStrategy(), response.getPartitionDistributionStrategy()); } | @GET @Path("/{id}") public Reflection getReflection(@PathParam("id") String id) { Optional<ReflectionGoal> goal = reflectionServiceHelper.getReflectionById(id); if (!goal.isPresent()) { throw new ReflectionNotFound(id); } String reflectionId = goal.get().getId().getId(); return new Reflection(goal.get(), reflectionServiceHelper.getStatusForReflection(reflectionId), reflectionServiceHelper.getCurrentSize(reflectionId), reflectionServiceHelper.getTotalSize(reflectionId)); } | ReflectionResource { @GET @Path("/{id}") public Reflection getReflection(@PathParam("id") String id) { Optional<ReflectionGoal> goal = reflectionServiceHelper.getReflectionById(id); if (!goal.isPresent()) { throw new ReflectionNotFound(id); } String reflectionId = goal.get().getId().getId(); return new Reflection(goal.get(), reflectionServiceHelper.getStatusForReflection(reflectionId), reflectionServiceHelper.getCurrentSize(reflectionId), reflectionServiceHelper.getTotalSize(reflectionId)); } } | ReflectionResource { @GET @Path("/{id}") public Reflection getReflection(@PathParam("id") String id) { Optional<ReflectionGoal> goal = reflectionServiceHelper.getReflectionById(id); if (!goal.isPresent()) { throw new ReflectionNotFound(id); } String reflectionId = goal.get().getId().getId(); return new Reflection(goal.get(), reflectionServiceHelper.getStatusForReflection(reflectionId), reflectionServiceHelper.getCurrentSize(reflectionId), reflectionServiceHelper.getTotalSize(reflectionId)); } @Inject ReflectionResource(ReflectionServiceHelper reflectionServiceHelper, CatalogServiceHelper catalogServiceHelper); } | ReflectionResource { @GET @Path("/{id}") public Reflection getReflection(@PathParam("id") String id) { Optional<ReflectionGoal> goal = reflectionServiceHelper.getReflectionById(id); if (!goal.isPresent()) { throw new ReflectionNotFound(id); } String reflectionId = goal.get().getId().getId(); return new Reflection(goal.get(), reflectionServiceHelper.getStatusForReflection(reflectionId), reflectionServiceHelper.getCurrentSize(reflectionId), reflectionServiceHelper.getTotalSize(reflectionId)); } @Inject ReflectionResource(ReflectionServiceHelper reflectionServiceHelper, CatalogServiceHelper catalogServiceHelper); @GET @Path("/{id}") Reflection getReflection(@PathParam("id") String id); @POST Reflection createReflection(Reflection reflection); @PUT @Path("/{id}") Reflection editReflection(@PathParam("id") String id, Reflection reflection); @DELETE @Path("/{id}") Response deleteReflection(@PathParam("id") String id); } | ReflectionResource { @GET @Path("/{id}") public Reflection getReflection(@PathParam("id") String id) { Optional<ReflectionGoal> goal = reflectionServiceHelper.getReflectionById(id); if (!goal.isPresent()) { throw new ReflectionNotFound(id); } String reflectionId = goal.get().getId().getId(); return new Reflection(goal.get(), reflectionServiceHelper.getStatusForReflection(reflectionId), reflectionServiceHelper.getCurrentSize(reflectionId), reflectionServiceHelper.getTotalSize(reflectionId)); } @Inject ReflectionResource(ReflectionServiceHelper reflectionServiceHelper, CatalogServiceHelper catalogServiceHelper); @GET @Path("/{id}") Reflection getReflection(@PathParam("id") String id); @POST Reflection createReflection(Reflection reflection); @PUT @Path("/{id}") Reflection editReflection(@PathParam("id") String id, Reflection reflection); @DELETE @Path("/{id}") Response deleteReflection(@PathParam("id") String id); } |
@Test public void test460Version() throws Exception { final Version version = new Version("4.6.0", 4, 6, 0, 0, ""); assertFalse(SetTableauDefaults.updateOptionsIfNeeded(version, () -> optionManager, true)); } | @VisibleForTesting static boolean updateOptionsIfNeeded(Version previousVersion, Supplier<SystemOptionManager> optionManagerSupplier, boolean isOptionManagerOpen) throws Exception { if (Upgrade.UPGRADE_VERSION_ORDERING.compare(previousVersion, VERSION_460) >= 0) { return false; } final SystemOptionManager optionManager = optionManagerSupplier.get(); try { if (!isOptionManagerOpen) { optionManager.start(); } final OptionValue regularTableauDefault = TableauResource.CLIENT_TOOLS_TABLEAU.getDefault(); final OptionValue tableauEnable = OptionValue.createBoolean(regularTableauDefault.getType(), regularTableauDefault.getName(), true); if (!optionManager.isSet(TableauResource.CLIENT_TOOLS_TABLEAU.getOptionName())) { optionManager.setOption(tableauEnable); return true; } return false; } finally { if (!isOptionManagerOpen) { optionManager.close(); } } } | SetTableauDefaults extends UpgradeTask { @VisibleForTesting static boolean updateOptionsIfNeeded(Version previousVersion, Supplier<SystemOptionManager> optionManagerSupplier, boolean isOptionManagerOpen) throws Exception { if (Upgrade.UPGRADE_VERSION_ORDERING.compare(previousVersion, VERSION_460) >= 0) { return false; } final SystemOptionManager optionManager = optionManagerSupplier.get(); try { if (!isOptionManagerOpen) { optionManager.start(); } final OptionValue regularTableauDefault = TableauResource.CLIENT_TOOLS_TABLEAU.getDefault(); final OptionValue tableauEnable = OptionValue.createBoolean(regularTableauDefault.getType(), regularTableauDefault.getName(), true); if (!optionManager.isSet(TableauResource.CLIENT_TOOLS_TABLEAU.getOptionName())) { optionManager.setOption(tableauEnable); return true; } return false; } finally { if (!isOptionManagerOpen) { optionManager.close(); } } } } | SetTableauDefaults extends UpgradeTask { @VisibleForTesting static boolean updateOptionsIfNeeded(Version previousVersion, Supplier<SystemOptionManager> optionManagerSupplier, boolean isOptionManagerOpen) throws Exception { if (Upgrade.UPGRADE_VERSION_ORDERING.compare(previousVersion, VERSION_460) >= 0) { return false; } final SystemOptionManager optionManager = optionManagerSupplier.get(); try { if (!isOptionManagerOpen) { optionManager.start(); } final OptionValue regularTableauDefault = TableauResource.CLIENT_TOOLS_TABLEAU.getDefault(); final OptionValue tableauEnable = OptionValue.createBoolean(regularTableauDefault.getType(), regularTableauDefault.getName(), true); if (!optionManager.isSet(TableauResource.CLIENT_TOOLS_TABLEAU.getOptionName())) { optionManager.setOption(tableauEnable); return true; } return false; } finally { if (!isOptionManagerOpen) { optionManager.close(); } } } SetTableauDefaults(); } | SetTableauDefaults extends UpgradeTask { @VisibleForTesting static boolean updateOptionsIfNeeded(Version previousVersion, Supplier<SystemOptionManager> optionManagerSupplier, boolean isOptionManagerOpen) throws Exception { if (Upgrade.UPGRADE_VERSION_ORDERING.compare(previousVersion, VERSION_460) >= 0) { return false; } final SystemOptionManager optionManager = optionManagerSupplier.get(); try { if (!isOptionManagerOpen) { optionManager.start(); } final OptionValue regularTableauDefault = TableauResource.CLIENT_TOOLS_TABLEAU.getDefault(); final OptionValue tableauEnable = OptionValue.createBoolean(regularTableauDefault.getType(), regularTableauDefault.getName(), true); if (!optionManager.isSet(TableauResource.CLIENT_TOOLS_TABLEAU.getOptionName())) { optionManager.setOption(tableauEnable); return true; } return false; } finally { if (!isOptionManagerOpen) { optionManager.close(); } } } SetTableauDefaults(); @Override String getTaskUUID(); @Override void upgrade(UpgradeContext context); } | SetTableauDefaults extends UpgradeTask { @VisibleForTesting static boolean updateOptionsIfNeeded(Version previousVersion, Supplier<SystemOptionManager> optionManagerSupplier, boolean isOptionManagerOpen) throws Exception { if (Upgrade.UPGRADE_VERSION_ORDERING.compare(previousVersion, VERSION_460) >= 0) { return false; } final SystemOptionManager optionManager = optionManagerSupplier.get(); try { if (!isOptionManagerOpen) { optionManager.start(); } final OptionValue regularTableauDefault = TableauResource.CLIENT_TOOLS_TABLEAU.getDefault(); final OptionValue tableauEnable = OptionValue.createBoolean(regularTableauDefault.getType(), regularTableauDefault.getName(), true); if (!optionManager.isSet(TableauResource.CLIENT_TOOLS_TABLEAU.getOptionName())) { optionManager.setOption(tableauEnable); return true; } return false; } finally { if (!isOptionManagerOpen) { optionManager.close(); } } } SetTableauDefaults(); @Override String getTaskUUID(); @Override void upgrade(UpgradeContext context); } |
@Test public void scorePair_shouldIndicateAMatchOnPatientsWithMultipleIdentifiersForAnIdentifierType() throws Exception { Record rec1 = new Record(1, "foo"); Record rec2 = new Record(2, "foo"); rec1.addDemographic("(Identifier) Old OpenMRS Identifier", "111,222,333"); rec2.addDemographic("(Identifier) Old OpenMRS Identifier", "222,444,555"); MatchingConfigRow mcr = new MatchingConfigRow("(Identifier) Old OpenMRS Identifier"); mcr.setInclude(true); MatchingConfig mc = new MatchingConfig("bar", new MatchingConfigRow[]{ mcr }); ScorePair sp = new ScorePair(mc); MatchResult mr = sp.scorePair(rec1, rec2); Assert.assertTrue(mr.matchedOn("(Identifier) Old OpenMRS Identifier")); } | public ScorePair(MatchingConfig mc) { this.mc = mc; vt = new VectorTable(mc); modifiers = new ArrayList<Modifier>(); observed_vectors = new Hashtable<MatchVector, Long>(); } | ScorePair { public ScorePair(MatchingConfig mc) { this.mc = mc; vt = new VectorTable(mc); modifiers = new ArrayList<Modifier>(); observed_vectors = new Hashtable<MatchVector, Long>(); } } | ScorePair { public ScorePair(MatchingConfig mc) { this.mc = mc; vt = new VectorTable(mc); modifiers = new ArrayList<Modifier>(); observed_vectors = new Hashtable<MatchVector, Long>(); } ScorePair(MatchingConfig mc); } | ScorePair { public ScorePair(MatchingConfig mc) { this.mc = mc; vt = new VectorTable(mc); modifiers = new ArrayList<Modifier>(); observed_vectors = new Hashtable<MatchVector, Long>(); } ScorePair(MatchingConfig mc); void addScoreModifier(Modifier sm); MatchResult scorePair(Record rec1, Record rec2); Hashtable<MatchVector, Long> getObservedVectors(); } | ScorePair { public ScorePair(MatchingConfig mc) { this.mc = mc; vt = new VectorTable(mc); modifiers = new ArrayList<Modifier>(); observed_vectors = new Hashtable<MatchVector, Long>(); } ScorePair(MatchingConfig mc); void addScoreModifier(Modifier sm); MatchResult scorePair(Record rec1, Record rec2); Hashtable<MatchVector, Long> getObservedVectors(); } |
@Test public void getCandidatesFromMultiFieldDemographics_shouldReturnAListOfAllPossiblePermutations() throws Exception { MatchingConfigRow mcr = new MatchingConfigRow("ack"); mcr.setInclude(true); MatchingConfig mc = new MatchingConfig("foo", new MatchingConfigRow[]{ mcr }); ScorePair sp = new ScorePair(mc); String data1 = "101" + MatchingConstants.MULTI_FIELD_DELIMITER + "202"; String data2 = "303" + MatchingConstants.MULTI_FIELD_DELIMITER + "404" + MatchingConstants.MULTI_FIELD_DELIMITER + "505"; List<String[]> expected = new ArrayList<String[]>(); expected.add(new String[]{ "101", "303"}); expected.add(new String[]{ "101", "404"}); expected.add(new String[]{ "101", "505"}); expected.add(new String[]{ "202", "303"}); expected.add(new String[]{ "202", "404"}); expected.add(new String[]{ "202", "505"}); List<String[]> actual = sp.getCandidatesFromMultiFieldDemographics(data1, data2); for (int i=0; i<6; i++) { Assert.assertEquals("permutation", expected.get(i)[0], actual.get(i)[0]); Assert.assertEquals("permutation", expected.get(i)[1], actual.get(i)[1]); } } | protected List<String[]> getCandidatesFromMultiFieldDemographics(String data1, String data2) { String[] a = data1.split(MatchingConstants.MULTI_FIELD_DELIMITER); String[] b = data2.split(MatchingConstants.MULTI_FIELD_DELIMITER); List<String[]> res = new ArrayList<String[]>(); for (String i : a) { for (String j : b) { res.add(new String[]{i, j}); } } return res; } | ScorePair { protected List<String[]> getCandidatesFromMultiFieldDemographics(String data1, String data2) { String[] a = data1.split(MatchingConstants.MULTI_FIELD_DELIMITER); String[] b = data2.split(MatchingConstants.MULTI_FIELD_DELIMITER); List<String[]> res = new ArrayList<String[]>(); for (String i : a) { for (String j : b) { res.add(new String[]{i, j}); } } return res; } } | ScorePair { protected List<String[]> getCandidatesFromMultiFieldDemographics(String data1, String data2) { String[] a = data1.split(MatchingConstants.MULTI_FIELD_DELIMITER); String[] b = data2.split(MatchingConstants.MULTI_FIELD_DELIMITER); List<String[]> res = new ArrayList<String[]>(); for (String i : a) { for (String j : b) { res.add(new String[]{i, j}); } } return res; } ScorePair(MatchingConfig mc); } | ScorePair { protected List<String[]> getCandidatesFromMultiFieldDemographics(String data1, String data2) { String[] a = data1.split(MatchingConstants.MULTI_FIELD_DELIMITER); String[] b = data2.split(MatchingConstants.MULTI_FIELD_DELIMITER); List<String[]> res = new ArrayList<String[]>(); for (String i : a) { for (String j : b) { res.add(new String[]{i, j}); } } return res; } ScorePair(MatchingConfig mc); void addScoreModifier(Modifier sm); MatchResult scorePair(Record rec1, Record rec2); Hashtable<MatchVector, Long> getObservedVectors(); } | ScorePair { protected List<String[]> getCandidatesFromMultiFieldDemographics(String data1, String data2) { String[] a = data1.split(MatchingConstants.MULTI_FIELD_DELIMITER); String[] b = data2.split(MatchingConstants.MULTI_FIELD_DELIMITER); List<String[]> res = new ArrayList<String[]>(); for (String i : a) { for (String j : b) { res.add(new String[]{i, j}); } } return res; } ScorePair(MatchingConfig mc); void addScoreModifier(Modifier sm); MatchResult scorePair(Record rec1, Record rec2); Hashtable<MatchVector, Long> getObservedVectors(); } |
@Test public void whenIncrementSalaryForEachEmployee_thenApplyNewSalary() { Employee[] arrayOfEmps = { new Employee(1, "Jeff Bezos", 100000.0), new Employee(2, "Bill Gates", 200000.0), new Employee(3, "Mark Zuckerberg", 300000.0) }; List<Employee> empList = Arrays.asList(arrayOfEmps); empList.stream().forEach(e -> e.salaryIncrement(10.0)); assertThat(empList, contains( hasProperty("salary", equalTo(110000.0)), hasProperty("salary", equalTo(220000.0)), hasProperty("salary", equalTo(330000.0)) )); } | public void salaryIncrement(Double percentage) { Double newSalary = salary + percentage * salary / 100; setSalary(newSalary); } | Employee { public void salaryIncrement(Double percentage) { Double newSalary = salary + percentage * salary / 100; setSalary(newSalary); } } | Employee { public void salaryIncrement(Double percentage) { Double newSalary = salary + percentage * salary / 100; setSalary(newSalary); } Employee(Integer id, String name, Double salary); } | Employee { public void salaryIncrement(Double percentage) { Double newSalary = salary + percentage * salary / 100; setSalary(newSalary); } Employee(Integer id, String name, Double salary); Integer getId(); void setId(Integer id); String getName(); void setName(String name); Double getSalary(); void setSalary(Double salary); void salaryIncrement(Double percentage); String toString(); } | Employee { public void salaryIncrement(Double percentage) { Double newSalary = salary + percentage * salary / 100; setSalary(newSalary); } Employee(Integer id, String name, Double salary); Integer getId(); void setId(Integer id); String getName(); void setName(String name); Double getSalary(); void setSalary(Double salary); void salaryIncrement(Double percentage); String toString(); } |
@Test public void testUndertowHttp2Enabled() { props.getHttp().setVersion(JHipsterProperties.Http.Version.V_2_0); UndertowServletWebServerFactory container = new UndertowServletWebServerFactory(); webConfigurer.customize(container); Builder builder = Undertow.builder(); container.getBuilderCustomizers().forEach(c -> c.customize(builder)); OptionMap.Builder serverOptions = (OptionMap.Builder) ReflectionTestUtils.getField(builder, "serverOptions"); assertThat(serverOptions.getMap().get(UndertowOptions.ENABLE_HTTP2)).isTrue(); } | @Override public void customize(WebServerFactory server) { setMimeMappings(server); setLocationForStaticAssets(server); if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) && server instanceof UndertowServletWebServerFactory) { ((UndertowServletWebServerFactory) server) .addBuilderCustomizers(builder -> builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true)); } } | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void customize(WebServerFactory server) { setMimeMappings(server); setLocationForStaticAssets(server); if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) && server instanceof UndertowServletWebServerFactory) { ((UndertowServletWebServerFactory) server) .addBuilderCustomizers(builder -> builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true)); } } } | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void customize(WebServerFactory server) { setMimeMappings(server); setLocationForStaticAssets(server); if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) && server instanceof UndertowServletWebServerFactory) { ((UndertowServletWebServerFactory) server) .addBuilderCustomizers(builder -> builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true)); } } WebConfigurer(Environment env, JHipsterProperties jHipsterProperties); } | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void customize(WebServerFactory server) { setMimeMappings(server); setLocationForStaticAssets(server); if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) && server instanceof UndertowServletWebServerFactory) { ((UndertowServletWebServerFactory) server) .addBuilderCustomizers(builder -> builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true)); } } WebConfigurer(Environment env, JHipsterProperties jHipsterProperties); @Override void onStartup(ServletContext servletContext); @Override void customize(WebServerFactory server); @Bean CorsFilter corsFilter(); @Autowired(required = false) void setMetricRegistry(MetricRegistry metricRegistry); } | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void customize(WebServerFactory server) { setMimeMappings(server); setLocationForStaticAssets(server); if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) && server instanceof UndertowServletWebServerFactory) { ((UndertowServletWebServerFactory) server) .addBuilderCustomizers(builder -> builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true)); } } WebConfigurer(Environment env, JHipsterProperties jHipsterProperties); @Override void onStartup(ServletContext servletContext); @Override void customize(WebServerFactory server); @Bean CorsFilter corsFilter(); @Autowired(required = false) void setMetricRegistry(MetricRegistry metricRegistry); } |
@Test public void testCorsFilterOnApiPath() throws Exception { props.getCors().setAllowedOrigins(Collections.singletonList("*")); props.getCors().setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE")); props.getCors().setAllowedHeaders(Collections.singletonList("*")); props.getCors().setMaxAge(1800L); props.getCors().setAllowCredentials(true); MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()) .addFilters(webConfigurer.corsFilter()) .build(); mockMvc.perform( options("/api/test-cors") .header(HttpHeaders.ORIGIN, "other.domain.com") .header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "POST")) .andExpect(status().isOk()) .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "other.domain.com")) .andExpect(header().string(HttpHeaders.VARY, "Origin")) .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "GET,POST,PUT,DELETE")) .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true")) .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_MAX_AGE, "1800")); mockMvc.perform( get("/api/test-cors") .header(HttpHeaders.ORIGIN, "other.domain.com")) .andExpect(status().isOk()) .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "other.domain.com")); } | @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) { log.debug("Registering CORS filter"); source.registerCorsConfiguration("/apiapimanagementoauth/**", config); } return new CorsFilter(source); } | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) { log.debug("Registering CORS filter"); source.registerCorsConfiguration("/apiapimanagementoauth/**", config); } return new CorsFilter(source); } } | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) { log.debug("Registering CORS filter"); source.registerCorsConfiguration("/apiapimanagementoauth/**", config); } return new CorsFilter(source); } WebConfigurer(Environment env, JHipsterProperties jHipsterProperties); } | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) { log.debug("Registering CORS filter"); source.registerCorsConfiguration("/apiapimanagementoauth/**", config); } return new CorsFilter(source); } WebConfigurer(Environment env, JHipsterProperties jHipsterProperties); @Override void onStartup(ServletContext servletContext); @Override void customize(WebServerFactory server); @Bean CorsFilter corsFilter(); @Autowired(required = false) void setMetricRegistry(MetricRegistry metricRegistry); } | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) { log.debug("Registering CORS filter"); source.registerCorsConfiguration("/apiapimanagementoauth/**", config); } return new CorsFilter(source); } WebConfigurer(Environment env, JHipsterProperties jHipsterProperties); @Override void onStartup(ServletContext servletContext); @Override void customize(WebServerFactory server); @Bean CorsFilter corsFilter(); @Autowired(required = false) void setMetricRegistry(MetricRegistry metricRegistry); } |
@Test public void testCorsFilterOnOtherPath() throws Exception { props.getCors().setAllowedOrigins(Collections.singletonList("*")); props.getCors().setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE")); props.getCors().setAllowedHeaders(Collections.singletonList("*")); props.getCors().setMaxAge(1800L); props.getCors().setAllowCredentials(true); MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()) .addFilters(webConfigurer.corsFilter()) .build(); mockMvc.perform( get("/test/test-cors") .header(HttpHeaders.ORIGIN, "other.domain.com")) .andExpect(status().isOk()) .andExpect(header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); } | @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) { log.debug("Registering CORS filter"); source.registerCorsConfiguration("/apiapimanagementoauth/**", config); } return new CorsFilter(source); } | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) { log.debug("Registering CORS filter"); source.registerCorsConfiguration("/apiapimanagementoauth/**", config); } return new CorsFilter(source); } } | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) { log.debug("Registering CORS filter"); source.registerCorsConfiguration("/apiapimanagementoauth/**", config); } return new CorsFilter(source); } WebConfigurer(Environment env, JHipsterProperties jHipsterProperties); } | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) { log.debug("Registering CORS filter"); source.registerCorsConfiguration("/apiapimanagementoauth/**", config); } return new CorsFilter(source); } WebConfigurer(Environment env, JHipsterProperties jHipsterProperties); @Override void onStartup(ServletContext servletContext); @Override void customize(WebServerFactory server); @Bean CorsFilter corsFilter(); @Autowired(required = false) void setMetricRegistry(MetricRegistry metricRegistry); } | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) { log.debug("Registering CORS filter"); source.registerCorsConfiguration("/apiapimanagementoauth/**", config); } return new CorsFilter(source); } WebConfigurer(Environment env, JHipsterProperties jHipsterProperties); @Override void onStartup(ServletContext servletContext); @Override void customize(WebServerFactory server); @Bean CorsFilter corsFilter(); @Autowired(required = false) void setMetricRegistry(MetricRegistry metricRegistry); } |
@Test public void testCorsFilterDeactivated() throws Exception { props.getCors().setAllowedOrigins(null); MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()) .addFilters(webConfigurer.corsFilter()) .build(); mockMvc.perform( get("/api/test-cors") .header(HttpHeaders.ORIGIN, "other.domain.com")) .andExpect(status().isOk()) .andExpect(header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); } | @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) { log.debug("Registering CORS filter"); source.registerCorsConfiguration("/apiapimanagementoauth/**", config); } return new CorsFilter(source); } | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) { log.debug("Registering CORS filter"); source.registerCorsConfiguration("/apiapimanagementoauth/**", config); } return new CorsFilter(source); } } | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) { log.debug("Registering CORS filter"); source.registerCorsConfiguration("/apiapimanagementoauth/**", config); } return new CorsFilter(source); } WebConfigurer(Environment env, JHipsterProperties jHipsterProperties); } | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) { log.debug("Registering CORS filter"); source.registerCorsConfiguration("/apiapimanagementoauth/**", config); } return new CorsFilter(source); } WebConfigurer(Environment env, JHipsterProperties jHipsterProperties); @Override void onStartup(ServletContext servletContext); @Override void customize(WebServerFactory server); @Bean CorsFilter corsFilter(); @Autowired(required = false) void setMetricRegistry(MetricRegistry metricRegistry); } | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) { log.debug("Registering CORS filter"); source.registerCorsConfiguration("/apiapimanagementoauth/**", config); } return new CorsFilter(source); } WebConfigurer(Environment env, JHipsterProperties jHipsterProperties); @Override void onStartup(ServletContext servletContext); @Override void customize(WebServerFactory server); @Bean CorsFilter corsFilter(); @Autowired(required = false) void setMetricRegistry(MetricRegistry metricRegistry); } |
@Test public void testCorsFilterDeactivated2() throws Exception { props.getCors().setAllowedOrigins(new ArrayList<>()); MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()) .addFilters(webConfigurer.corsFilter()) .build(); mockMvc.perform( get("/api/test-cors") .header(HttpHeaders.ORIGIN, "other.domain.com")) .andExpect(status().isOk()) .andExpect(header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); } | @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) { log.debug("Registering CORS filter"); source.registerCorsConfiguration("/apiapimanagementoauth/**", config); } return new CorsFilter(source); } | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) { log.debug("Registering CORS filter"); source.registerCorsConfiguration("/apiapimanagementoauth/**", config); } return new CorsFilter(source); } } | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) { log.debug("Registering CORS filter"); source.registerCorsConfiguration("/apiapimanagementoauth/**", config); } return new CorsFilter(source); } WebConfigurer(Environment env, JHipsterProperties jHipsterProperties); } | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) { log.debug("Registering CORS filter"); source.registerCorsConfiguration("/apiapimanagementoauth/**", config); } return new CorsFilter(source); } WebConfigurer(Environment env, JHipsterProperties jHipsterProperties); @Override void onStartup(ServletContext servletContext); @Override void customize(WebServerFactory server); @Bean CorsFilter corsFilter(); @Autowired(required = false) void setMetricRegistry(MetricRegistry metricRegistry); } | WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (config.getAllowedOrigins() != null && !config.getAllowedOrigins().isEmpty()) { log.debug("Registering CORS filter"); source.registerCorsConfiguration("/apiapimanagementoauth/**", config); } return new CorsFilter(source); } WebConfigurer(Environment env, JHipsterProperties jHipsterProperties); @Override void onStartup(ServletContext servletContext); @Override void customize(WebServerFactory server); @Bean CorsFilter corsFilter(); @Autowired(required = false) void setMetricRegistry(MetricRegistry metricRegistry); } |
@Test public void shouldFilter_on_default_swagger_url() { MockHttpServletRequest request = new MockHttpServletRequest("GET", DEFAULT_URL); RequestContext.getCurrentContext().setRequest(request); assertTrue(filter.shouldFilter()); } | @Override public boolean shouldFilter() { return RequestContext.getCurrentContext().getRequest().getRequestURI().endsWith(Swagger2Controller.DEFAULT_URL); } | SwaggerBasePathRewritingFilter extends SendResponseFilter { @Override public boolean shouldFilter() { return RequestContext.getCurrentContext().getRequest().getRequestURI().endsWith(Swagger2Controller.DEFAULT_URL); } } | SwaggerBasePathRewritingFilter extends SendResponseFilter { @Override public boolean shouldFilter() { return RequestContext.getCurrentContext().getRequest().getRequestURI().endsWith(Swagger2Controller.DEFAULT_URL); } SwaggerBasePathRewritingFilter(); } | SwaggerBasePathRewritingFilter extends SendResponseFilter { @Override public boolean shouldFilter() { return RequestContext.getCurrentContext().getRequest().getRequestURI().endsWith(Swagger2Controller.DEFAULT_URL); } SwaggerBasePathRewritingFilter(); @Override String filterType(); @Override int filterOrder(); @Override boolean shouldFilter(); @Override Object run(); static byte[] gzipData(String content); } | SwaggerBasePathRewritingFilter extends SendResponseFilter { @Override public boolean shouldFilter() { return RequestContext.getCurrentContext().getRequest().getRequestURI().endsWith(Swagger2Controller.DEFAULT_URL); } SwaggerBasePathRewritingFilter(); @Override String filterType(); @Override int filterOrder(); @Override boolean shouldFilter(); @Override Object run(); static byte[] gzipData(String content); } |
@Test public void shouldFilter_on_default_swagger_url_with_param() { MockHttpServletRequest request = new MockHttpServletRequest("GET", DEFAULT_URL); request.setParameter("debug", "true"); RequestContext.getCurrentContext().setRequest(request); assertTrue(filter.shouldFilter()); } | @Override public boolean shouldFilter() { return RequestContext.getCurrentContext().getRequest().getRequestURI().endsWith(Swagger2Controller.DEFAULT_URL); } | SwaggerBasePathRewritingFilter extends SendResponseFilter { @Override public boolean shouldFilter() { return RequestContext.getCurrentContext().getRequest().getRequestURI().endsWith(Swagger2Controller.DEFAULT_URL); } } | SwaggerBasePathRewritingFilter extends SendResponseFilter { @Override public boolean shouldFilter() { return RequestContext.getCurrentContext().getRequest().getRequestURI().endsWith(Swagger2Controller.DEFAULT_URL); } SwaggerBasePathRewritingFilter(); } | SwaggerBasePathRewritingFilter extends SendResponseFilter { @Override public boolean shouldFilter() { return RequestContext.getCurrentContext().getRequest().getRequestURI().endsWith(Swagger2Controller.DEFAULT_URL); } SwaggerBasePathRewritingFilter(); @Override String filterType(); @Override int filterOrder(); @Override boolean shouldFilter(); @Override Object run(); static byte[] gzipData(String content); } | SwaggerBasePathRewritingFilter extends SendResponseFilter { @Override public boolean shouldFilter() { return RequestContext.getCurrentContext().getRequest().getRequestURI().endsWith(Swagger2Controller.DEFAULT_URL); } SwaggerBasePathRewritingFilter(); @Override String filterType(); @Override int filterOrder(); @Override boolean shouldFilter(); @Override Object run(); static byte[] gzipData(String content); } |
@Test public void shouldNotFilter_on_wrong_url() { MockHttpServletRequest request = new MockHttpServletRequest("GET", "/management/info"); RequestContext.getCurrentContext().setRequest(request); assertFalse(filter.shouldFilter()); } | @Override public boolean shouldFilter() { return RequestContext.getCurrentContext().getRequest().getRequestURI().endsWith(Swagger2Controller.DEFAULT_URL); } | SwaggerBasePathRewritingFilter extends SendResponseFilter { @Override public boolean shouldFilter() { return RequestContext.getCurrentContext().getRequest().getRequestURI().endsWith(Swagger2Controller.DEFAULT_URL); } } | SwaggerBasePathRewritingFilter extends SendResponseFilter { @Override public boolean shouldFilter() { return RequestContext.getCurrentContext().getRequest().getRequestURI().endsWith(Swagger2Controller.DEFAULT_URL); } SwaggerBasePathRewritingFilter(); } | SwaggerBasePathRewritingFilter extends SendResponseFilter { @Override public boolean shouldFilter() { return RequestContext.getCurrentContext().getRequest().getRequestURI().endsWith(Swagger2Controller.DEFAULT_URL); } SwaggerBasePathRewritingFilter(); @Override String filterType(); @Override int filterOrder(); @Override boolean shouldFilter(); @Override Object run(); static byte[] gzipData(String content); } | SwaggerBasePathRewritingFilter extends SendResponseFilter { @Override public boolean shouldFilter() { return RequestContext.getCurrentContext().getRequest().getRequestURI().endsWith(Swagger2Controller.DEFAULT_URL); } SwaggerBasePathRewritingFilter(); @Override String filterType(); @Override int filterOrder(); @Override boolean shouldFilter(); @Override Object run(); static byte[] gzipData(String content); } |
@Test public void run_on_valid_response() throws Exception { MockHttpServletRequest request = new MockHttpServletRequest("GET", "/service1" + DEFAULT_URL); RequestContext context = RequestContext.getCurrentContext(); context.setRequest(request); MockHttpServletResponse response = new MockHttpServletResponse(); context.setResponseGZipped(false); context.setResponse(response); InputStream in = IOUtils.toInputStream("{\"basePath\":\"/\"}", StandardCharsets.UTF_8); context.setResponseDataStream(in); filter.run(); assertEquals("UTF-8", response.getCharacterEncoding()); assertEquals("{\"basePath\":\"/service1\"}", context.getResponseBody()); } | @Override public Object run() { RequestContext context = RequestContext.getCurrentContext(); context.getResponse().setCharacterEncoding("UTF-8"); String rewrittenResponse = rewriteBasePath(context); if (context.getResponseGZipped()) { try { context.setResponseDataStream(new ByteArrayInputStream(gzipData(rewrittenResponse))); } catch (IOException e) { log.error("Swagger-docs filter error", e); } } else { context.setResponseBody(rewrittenResponse); } return null; } | SwaggerBasePathRewritingFilter extends SendResponseFilter { @Override public Object run() { RequestContext context = RequestContext.getCurrentContext(); context.getResponse().setCharacterEncoding("UTF-8"); String rewrittenResponse = rewriteBasePath(context); if (context.getResponseGZipped()) { try { context.setResponseDataStream(new ByteArrayInputStream(gzipData(rewrittenResponse))); } catch (IOException e) { log.error("Swagger-docs filter error", e); } } else { context.setResponseBody(rewrittenResponse); } return null; } } | SwaggerBasePathRewritingFilter extends SendResponseFilter { @Override public Object run() { RequestContext context = RequestContext.getCurrentContext(); context.getResponse().setCharacterEncoding("UTF-8"); String rewrittenResponse = rewriteBasePath(context); if (context.getResponseGZipped()) { try { context.setResponseDataStream(new ByteArrayInputStream(gzipData(rewrittenResponse))); } catch (IOException e) { log.error("Swagger-docs filter error", e); } } else { context.setResponseBody(rewrittenResponse); } return null; } SwaggerBasePathRewritingFilter(); } | SwaggerBasePathRewritingFilter extends SendResponseFilter { @Override public Object run() { RequestContext context = RequestContext.getCurrentContext(); context.getResponse().setCharacterEncoding("UTF-8"); String rewrittenResponse = rewriteBasePath(context); if (context.getResponseGZipped()) { try { context.setResponseDataStream(new ByteArrayInputStream(gzipData(rewrittenResponse))); } catch (IOException e) { log.error("Swagger-docs filter error", e); } } else { context.setResponseBody(rewrittenResponse); } return null; } SwaggerBasePathRewritingFilter(); @Override String filterType(); @Override int filterOrder(); @Override boolean shouldFilter(); @Override Object run(); static byte[] gzipData(String content); } | SwaggerBasePathRewritingFilter extends SendResponseFilter { @Override public Object run() { RequestContext context = RequestContext.getCurrentContext(); context.getResponse().setCharacterEncoding("UTF-8"); String rewrittenResponse = rewriteBasePath(context); if (context.getResponseGZipped()) { try { context.setResponseDataStream(new ByteArrayInputStream(gzipData(rewrittenResponse))); } catch (IOException e) { log.error("Swagger-docs filter error", e); } } else { context.setResponseBody(rewrittenResponse); } return null; } SwaggerBasePathRewritingFilter(); @Override String filterType(); @Override int filterOrder(); @Override boolean shouldFilter(); @Override Object run(); static byte[] gzipData(String content); } |
@Test public void whenStreamMapping_thenGetMap() { Map<Character, List<Integer>> idGroupedByAlphabet = empList.stream().collect( Collectors.groupingBy(e -> new Character(e.getName().charAt(0)), Collectors.mapping(Employee::getId, Collectors.toList()))); assertEquals(idGroupedByAlphabet.get('B').get(0), new Integer(2)); assertEquals(idGroupedByAlphabet.get('J').get(0), new Integer(1)); assertEquals(idGroupedByAlphabet.get('M').get(0), new Integer(3)); } | public String getName() { return name; } | Employee { public String getName() { return name; } } | Employee { public String getName() { return name; } Employee(Integer id, String name, Double salary); } | Employee { public String getName() { return name; } Employee(Integer id, String name, Double salary); Integer getId(); void setId(Integer id); String getName(); void setName(String name); Double getSalary(); void setSalary(Double salary); void salaryIncrement(Double percentage); String toString(); } | Employee { public String getName() { return name; } Employee(Integer id, String name, Double salary); Integer getId(); void setId(Integer id); String getName(); void setName(String name); Double getSalary(); void setSalary(Double salary); void salaryIncrement(Double percentage); String toString(); } |
@Test public void whenStreamReducing_thenGetValue() { Double percentage = 10.0; Double salIncrOverhead = empList.stream().collect(Collectors.reducing( 0.0, e -> e.getSalary() * percentage / 100, (s1, s2) -> s1 + s2)); assertEquals(salIncrOverhead, 60000.0, 0); } | public Double getSalary() { return salary; } | Employee { public Double getSalary() { return salary; } } | Employee { public Double getSalary() { return salary; } Employee(Integer id, String name, Double salary); } | Employee { public Double getSalary() { return salary; } Employee(Integer id, String name, Double salary); Integer getId(); void setId(Integer id); String getName(); void setName(String name); Double getSalary(); void setSalary(Double salary); void salaryIncrement(Double percentage); String toString(); } | Employee { public Double getSalary() { return salary; } Employee(Integer id, String name, Double salary); Integer getId(); void setId(Integer id); String getName(); void setName(String name); Double getSalary(); void setSalary(Double salary); void salaryIncrement(Double percentage); String toString(); } |
@Test public void whenStreamGroupingAndReducing_thenGetMap() { Comparator<Employee> byNameLength = Comparator.comparing(Employee::getName); Map<Character, Optional<Employee>> longestNameByAlphabet = empList.stream().collect( Collectors.groupingBy(e -> new Character(e.getName().charAt(0)), Collectors.reducing(BinaryOperator.maxBy(byNameLength)))); assertEquals(longestNameByAlphabet.get('B').get().getName(), "Bill Gates"); assertEquals(longestNameByAlphabet.get('J').get().getName(), "Jeff Bezos"); assertEquals(longestNameByAlphabet.get('M').get().getName(), "Mark Zuckerberg"); } | public String getName() { return name; } | Employee { public String getName() { return name; } } | Employee { public String getName() { return name; } Employee(Integer id, String name, Double salary); } | Employee { public String getName() { return name; } Employee(Integer id, String name, Double salary); Integer getId(); void setId(Integer id); String getName(); void setName(String name); Double getSalary(); void setSalary(Double salary); void salaryIncrement(Double percentage); String toString(); } | Employee { public String getName() { return name; } Employee(Integer id, String name, Double salary); Integer getId(); void setId(Integer id); String getName(); void setName(String name); Double getSalary(); void setSalary(Double salary); void salaryIncrement(Double percentage); String toString(); } |
@Test public void whenParallelStream_thenPerformOperationsInParallel() { Employee[] arrayOfEmps = { new Employee(1, "Jeff Bezos", 100000.0), new Employee(2, "Bill Gates", 200000.0), new Employee(3, "Mark Zuckerberg", 300000.0) }; List<Employee> empList = Arrays.asList(arrayOfEmps); empList.stream().parallel().forEach(e -> e.salaryIncrement(10.0)); assertThat(empList, contains( hasProperty("salary", equalTo(110000.0)), hasProperty("salary", equalTo(220000.0)), hasProperty("salary", equalTo(330000.0)) )); } | public void salaryIncrement(Double percentage) { Double newSalary = salary + percentage * salary / 100; setSalary(newSalary); } | Employee { public void salaryIncrement(Double percentage) { Double newSalary = salary + percentage * salary / 100; setSalary(newSalary); } } | Employee { public void salaryIncrement(Double percentage) { Double newSalary = salary + percentage * salary / 100; setSalary(newSalary); } Employee(Integer id, String name, Double salary); } | Employee { public void salaryIncrement(Double percentage) { Double newSalary = salary + percentage * salary / 100; setSalary(newSalary); } Employee(Integer id, String name, Double salary); Integer getId(); void setId(Integer id); String getName(); void setName(String name); Double getSalary(); void setSalary(Double salary); void salaryIncrement(Double percentage); String toString(); } | Employee { public void salaryIncrement(Double percentage) { Double newSalary = salary + percentage * salary / 100; setSalary(newSalary); } Employee(Integer id, String name, Double salary); Integer getId(); void setId(Integer id); String getName(); void setName(String name); Double getSalary(); void setSalary(Double salary); void salaryIncrement(Double percentage); String toString(); } |
@Test void whenConvertSize_thenOK() { String label = "S"; String countryCode = "fr"; int result = 36; when(service.convertSize(label, countryCode)).thenReturn(result); int actual = tested.convertSize(label, countryCode); assertEquals(actual, result); } | @RequestMapping(value ="convertSize", method = RequestMethod.GET) public int convertSize(@RequestParam(value = "label") final String label, @RequestParam(value = "countryCode", required = false) final String countryCode) { return service.convertSize(label, countryCode); } | TshirtSizeController { @RequestMapping(value ="convertSize", method = RequestMethod.GET) public int convertSize(@RequestParam(value = "label") final String label, @RequestParam(value = "countryCode", required = false) final String countryCode) { return service.convertSize(label, countryCode); } } | TshirtSizeController { @RequestMapping(value ="convertSize", method = RequestMethod.GET) public int convertSize(@RequestParam(value = "label") final String label, @RequestParam(value = "countryCode", required = false) final String countryCode) { return service.convertSize(label, countryCode); } TshirtSizeController(SizeConverterService service); } | TshirtSizeController { @RequestMapping(value ="convertSize", method = RequestMethod.GET) public int convertSize(@RequestParam(value = "label") final String label, @RequestParam(value = "countryCode", required = false) final String countryCode) { return service.convertSize(label, countryCode); } TshirtSizeController(SizeConverterService service); @RequestMapping(value ="convertSize", method = RequestMethod.GET) int convertSize(@RequestParam(value = "label") final String label, @RequestParam(value = "countryCode", required = false) final String countryCode); } | TshirtSizeController { @RequestMapping(value ="convertSize", method = RequestMethod.GET) public int convertSize(@RequestParam(value = "label") final String label, @RequestParam(value = "countryCode", required = false) final String countryCode) { return service.convertSize(label, countryCode); } TshirtSizeController(SizeConverterService service); @RequestMapping(value ="convertSize", method = RequestMethod.GET) int convertSize(@RequestParam(value = "label") final String label, @RequestParam(value = "countryCode", required = false) final String countryCode); } |
@Test public void idTest() { } | public Order id(Long id) { this.id = id; return this; } | Order { public Order id(Long id) { this.id = id; return this; } } | Order { public Order id(Long id) { this.id = id; return this; } } | Order { public Order id(Long id) { this.id = id; return this; } Order id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Order petId(Long petId); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PET_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getPetId(); void setPetId(Long petId); Order quantity(Integer quantity); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_QUANTITY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getQuantity(); void setQuantity(Integer quantity); Order shipDate(OffsetDateTime shipDate); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SHIP_DATE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) OffsetDateTime getShipDate(); void setShipDate(OffsetDateTime shipDate); Order status(StatusEnum status); @javax.annotation.Nullable @ApiModelProperty(value = "Order Status") @JsonProperty(JSON_PROPERTY_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) StatusEnum getStatus(); void setStatus(StatusEnum status); Order complete(Boolean complete); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_COMPLETE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Boolean getComplete(); void setComplete(Boolean complete); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); } | Order { public Order id(Long id) { this.id = id; return this; } Order id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Order petId(Long petId); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PET_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getPetId(); void setPetId(Long petId); Order quantity(Integer quantity); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_QUANTITY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getQuantity(); void setQuantity(Integer quantity); Order shipDate(OffsetDateTime shipDate); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SHIP_DATE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) OffsetDateTime getShipDate(); void setShipDate(OffsetDateTime shipDate); Order status(StatusEnum status); @javax.annotation.Nullable @ApiModelProperty(value = "Order Status") @JsonProperty(JSON_PROPERTY_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) StatusEnum getStatus(); void setStatus(StatusEnum status); Order complete(Boolean complete); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_COMPLETE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Boolean getComplete(); void setComplete(Boolean complete); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String JSON_PROPERTY_ID; static final String JSON_PROPERTY_PET_ID; static final String JSON_PROPERTY_QUANTITY; static final String JSON_PROPERTY_SHIP_DATE; static final String JSON_PROPERTY_STATUS; static final String JSON_PROPERTY_COMPLETE; } |
@Test public void petIdTest() { } | public Order petId(Long petId) { this.petId = petId; return this; } | Order { public Order petId(Long petId) { this.petId = petId; return this; } } | Order { public Order petId(Long petId) { this.petId = petId; return this; } } | Order { public Order petId(Long petId) { this.petId = petId; return this; } Order id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Order petId(Long petId); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PET_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getPetId(); void setPetId(Long petId); Order quantity(Integer quantity); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_QUANTITY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getQuantity(); void setQuantity(Integer quantity); Order shipDate(OffsetDateTime shipDate); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SHIP_DATE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) OffsetDateTime getShipDate(); void setShipDate(OffsetDateTime shipDate); Order status(StatusEnum status); @javax.annotation.Nullable @ApiModelProperty(value = "Order Status") @JsonProperty(JSON_PROPERTY_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) StatusEnum getStatus(); void setStatus(StatusEnum status); Order complete(Boolean complete); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_COMPLETE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Boolean getComplete(); void setComplete(Boolean complete); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); } | Order { public Order petId(Long petId) { this.petId = petId; return this; } Order id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Order petId(Long petId); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PET_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getPetId(); void setPetId(Long petId); Order quantity(Integer quantity); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_QUANTITY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getQuantity(); void setQuantity(Integer quantity); Order shipDate(OffsetDateTime shipDate); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SHIP_DATE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) OffsetDateTime getShipDate(); void setShipDate(OffsetDateTime shipDate); Order status(StatusEnum status); @javax.annotation.Nullable @ApiModelProperty(value = "Order Status") @JsonProperty(JSON_PROPERTY_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) StatusEnum getStatus(); void setStatus(StatusEnum status); Order complete(Boolean complete); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_COMPLETE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Boolean getComplete(); void setComplete(Boolean complete); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String JSON_PROPERTY_ID; static final String JSON_PROPERTY_PET_ID; static final String JSON_PROPERTY_QUANTITY; static final String JSON_PROPERTY_SHIP_DATE; static final String JSON_PROPERTY_STATUS; static final String JSON_PROPERTY_COMPLETE; } |
@Test public void quantityTest() { } | public Order quantity(Integer quantity) { this.quantity = quantity; return this; } | Order { public Order quantity(Integer quantity) { this.quantity = quantity; return this; } } | Order { public Order quantity(Integer quantity) { this.quantity = quantity; return this; } } | Order { public Order quantity(Integer quantity) { this.quantity = quantity; return this; } Order id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Order petId(Long petId); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PET_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getPetId(); void setPetId(Long petId); Order quantity(Integer quantity); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_QUANTITY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getQuantity(); void setQuantity(Integer quantity); Order shipDate(OffsetDateTime shipDate); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SHIP_DATE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) OffsetDateTime getShipDate(); void setShipDate(OffsetDateTime shipDate); Order status(StatusEnum status); @javax.annotation.Nullable @ApiModelProperty(value = "Order Status") @JsonProperty(JSON_PROPERTY_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) StatusEnum getStatus(); void setStatus(StatusEnum status); Order complete(Boolean complete); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_COMPLETE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Boolean getComplete(); void setComplete(Boolean complete); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); } | Order { public Order quantity(Integer quantity) { this.quantity = quantity; return this; } Order id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Order petId(Long petId); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PET_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getPetId(); void setPetId(Long petId); Order quantity(Integer quantity); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_QUANTITY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getQuantity(); void setQuantity(Integer quantity); Order shipDate(OffsetDateTime shipDate); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SHIP_DATE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) OffsetDateTime getShipDate(); void setShipDate(OffsetDateTime shipDate); Order status(StatusEnum status); @javax.annotation.Nullable @ApiModelProperty(value = "Order Status") @JsonProperty(JSON_PROPERTY_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) StatusEnum getStatus(); void setStatus(StatusEnum status); Order complete(Boolean complete); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_COMPLETE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Boolean getComplete(); void setComplete(Boolean complete); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String JSON_PROPERTY_ID; static final String JSON_PROPERTY_PET_ID; static final String JSON_PROPERTY_QUANTITY; static final String JSON_PROPERTY_SHIP_DATE; static final String JSON_PROPERTY_STATUS; static final String JSON_PROPERTY_COMPLETE; } |
@Test public void shipDateTest() { } | public Order shipDate(OffsetDateTime shipDate) { this.shipDate = shipDate; return this; } | Order { public Order shipDate(OffsetDateTime shipDate) { this.shipDate = shipDate; return this; } } | Order { public Order shipDate(OffsetDateTime shipDate) { this.shipDate = shipDate; return this; } } | Order { public Order shipDate(OffsetDateTime shipDate) { this.shipDate = shipDate; return this; } Order id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Order petId(Long petId); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PET_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getPetId(); void setPetId(Long petId); Order quantity(Integer quantity); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_QUANTITY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getQuantity(); void setQuantity(Integer quantity); Order shipDate(OffsetDateTime shipDate); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SHIP_DATE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) OffsetDateTime getShipDate(); void setShipDate(OffsetDateTime shipDate); Order status(StatusEnum status); @javax.annotation.Nullable @ApiModelProperty(value = "Order Status") @JsonProperty(JSON_PROPERTY_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) StatusEnum getStatus(); void setStatus(StatusEnum status); Order complete(Boolean complete); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_COMPLETE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Boolean getComplete(); void setComplete(Boolean complete); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); } | Order { public Order shipDate(OffsetDateTime shipDate) { this.shipDate = shipDate; return this; } Order id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Order petId(Long petId); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PET_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getPetId(); void setPetId(Long petId); Order quantity(Integer quantity); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_QUANTITY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getQuantity(); void setQuantity(Integer quantity); Order shipDate(OffsetDateTime shipDate); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SHIP_DATE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) OffsetDateTime getShipDate(); void setShipDate(OffsetDateTime shipDate); Order status(StatusEnum status); @javax.annotation.Nullable @ApiModelProperty(value = "Order Status") @JsonProperty(JSON_PROPERTY_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) StatusEnum getStatus(); void setStatus(StatusEnum status); Order complete(Boolean complete); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_COMPLETE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Boolean getComplete(); void setComplete(Boolean complete); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String JSON_PROPERTY_ID; static final String JSON_PROPERTY_PET_ID; static final String JSON_PROPERTY_QUANTITY; static final String JSON_PROPERTY_SHIP_DATE; static final String JSON_PROPERTY_STATUS; static final String JSON_PROPERTY_COMPLETE; } |
@Test public void statusTest() { } | public Order status(StatusEnum status) { this.status = status; return this; } | Order { public Order status(StatusEnum status) { this.status = status; return this; } } | Order { public Order status(StatusEnum status) { this.status = status; return this; } } | Order { public Order status(StatusEnum status) { this.status = status; return this; } Order id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Order petId(Long petId); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PET_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getPetId(); void setPetId(Long petId); Order quantity(Integer quantity); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_QUANTITY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getQuantity(); void setQuantity(Integer quantity); Order shipDate(OffsetDateTime shipDate); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SHIP_DATE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) OffsetDateTime getShipDate(); void setShipDate(OffsetDateTime shipDate); Order status(StatusEnum status); @javax.annotation.Nullable @ApiModelProperty(value = "Order Status") @JsonProperty(JSON_PROPERTY_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) StatusEnum getStatus(); void setStatus(StatusEnum status); Order complete(Boolean complete); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_COMPLETE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Boolean getComplete(); void setComplete(Boolean complete); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); } | Order { public Order status(StatusEnum status) { this.status = status; return this; } Order id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Order petId(Long petId); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PET_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getPetId(); void setPetId(Long petId); Order quantity(Integer quantity); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_QUANTITY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getQuantity(); void setQuantity(Integer quantity); Order shipDate(OffsetDateTime shipDate); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SHIP_DATE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) OffsetDateTime getShipDate(); void setShipDate(OffsetDateTime shipDate); Order status(StatusEnum status); @javax.annotation.Nullable @ApiModelProperty(value = "Order Status") @JsonProperty(JSON_PROPERTY_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) StatusEnum getStatus(); void setStatus(StatusEnum status); Order complete(Boolean complete); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_COMPLETE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Boolean getComplete(); void setComplete(Boolean complete); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String JSON_PROPERTY_ID; static final String JSON_PROPERTY_PET_ID; static final String JSON_PROPERTY_QUANTITY; static final String JSON_PROPERTY_SHIP_DATE; static final String JSON_PROPERTY_STATUS; static final String JSON_PROPERTY_COMPLETE; } |
@Test public void whenIncrementSalaryUsingPeek_thenApplyNewSalary() { Employee[] arrayOfEmps = { new Employee(1, "Jeff Bezos", 100000.0), new Employee(2, "Bill Gates", 200000.0), new Employee(3, "Mark Zuckerberg", 300000.0) }; List<Employee> empList = Arrays.asList(arrayOfEmps); empList.stream() .peek(e -> e.salaryIncrement(10.0)) .peek(System.out::println) .collect(Collectors.toList()); assertThat(empList, contains( hasProperty("salary", equalTo(110000.0)), hasProperty("salary", equalTo(220000.0)), hasProperty("salary", equalTo(330000.0)) )); } | public void salaryIncrement(Double percentage) { Double newSalary = salary + percentage * salary / 100; setSalary(newSalary); } | Employee { public void salaryIncrement(Double percentage) { Double newSalary = salary + percentage * salary / 100; setSalary(newSalary); } } | Employee { public void salaryIncrement(Double percentage) { Double newSalary = salary + percentage * salary / 100; setSalary(newSalary); } Employee(Integer id, String name, Double salary); } | Employee { public void salaryIncrement(Double percentage) { Double newSalary = salary + percentage * salary / 100; setSalary(newSalary); } Employee(Integer id, String name, Double salary); Integer getId(); void setId(Integer id); String getName(); void setName(String name); Double getSalary(); void setSalary(Double salary); void salaryIncrement(Double percentage); String toString(); } | Employee { public void salaryIncrement(Double percentage) { Double newSalary = salary + percentage * salary / 100; setSalary(newSalary); } Employee(Integer id, String name, Double salary); Integer getId(); void setId(Integer id); String getName(); void setName(String name); Double getSalary(); void setSalary(Double salary); void salaryIncrement(Double percentage); String toString(); } |
@Test public void completeTest() { } | public Order complete(Boolean complete) { this.complete = complete; return this; } | Order { public Order complete(Boolean complete) { this.complete = complete; return this; } } | Order { public Order complete(Boolean complete) { this.complete = complete; return this; } } | Order { public Order complete(Boolean complete) { this.complete = complete; return this; } Order id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Order petId(Long petId); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PET_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getPetId(); void setPetId(Long petId); Order quantity(Integer quantity); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_QUANTITY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getQuantity(); void setQuantity(Integer quantity); Order shipDate(OffsetDateTime shipDate); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SHIP_DATE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) OffsetDateTime getShipDate(); void setShipDate(OffsetDateTime shipDate); Order status(StatusEnum status); @javax.annotation.Nullable @ApiModelProperty(value = "Order Status") @JsonProperty(JSON_PROPERTY_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) StatusEnum getStatus(); void setStatus(StatusEnum status); Order complete(Boolean complete); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_COMPLETE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Boolean getComplete(); void setComplete(Boolean complete); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); } | Order { public Order complete(Boolean complete) { this.complete = complete; return this; } Order id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Order petId(Long petId); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PET_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getPetId(); void setPetId(Long petId); Order quantity(Integer quantity); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_QUANTITY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getQuantity(); void setQuantity(Integer quantity); Order shipDate(OffsetDateTime shipDate); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_SHIP_DATE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) OffsetDateTime getShipDate(); void setShipDate(OffsetDateTime shipDate); Order status(StatusEnum status); @javax.annotation.Nullable @ApiModelProperty(value = "Order Status") @JsonProperty(JSON_PROPERTY_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) StatusEnum getStatus(); void setStatus(StatusEnum status); Order complete(Boolean complete); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_COMPLETE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Boolean getComplete(); void setComplete(Boolean complete); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String JSON_PROPERTY_ID; static final String JSON_PROPERTY_PET_ID; static final String JSON_PROPERTY_QUANTITY; static final String JSON_PROPERTY_SHIP_DATE; static final String JSON_PROPERTY_STATUS; static final String JSON_PROPERTY_COMPLETE; } |
@Test public void idTest() { } | public User id(Long id) { this.id = id; return this; } | User { public User id(Long id) { this.id = id; return this; } } | User { public User id(Long id) { this.id = id; return this; } } | User { public User id(Long id) { this.id = id; return this; } User id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); User username(String username); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_USERNAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getUsername(); void setUsername(String username); User firstName(String firstName); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_FIRST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getFirstName(); void setFirstName(String firstName); User lastName(String lastName); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_LAST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getLastName(); void setLastName(String lastName); User email(String email); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_EMAIL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getEmail(); void setEmail(String email); User password(String password); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PASSWORD) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getPassword(); void setPassword(String password); User phone(String phone); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PHONE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getPhone(); void setPhone(String phone); User userStatus(Integer userStatus); @javax.annotation.Nullable @ApiModelProperty(value = "User Status") @JsonProperty(JSON_PROPERTY_USER_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getUserStatus(); void setUserStatus(Integer userStatus); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); } | User { public User id(Long id) { this.id = id; return this; } User id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); User username(String username); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_USERNAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getUsername(); void setUsername(String username); User firstName(String firstName); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_FIRST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getFirstName(); void setFirstName(String firstName); User lastName(String lastName); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_LAST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getLastName(); void setLastName(String lastName); User email(String email); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_EMAIL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getEmail(); void setEmail(String email); User password(String password); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PASSWORD) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getPassword(); void setPassword(String password); User phone(String phone); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PHONE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getPhone(); void setPhone(String phone); User userStatus(Integer userStatus); @javax.annotation.Nullable @ApiModelProperty(value = "User Status") @JsonProperty(JSON_PROPERTY_USER_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getUserStatus(); void setUserStatus(Integer userStatus); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String JSON_PROPERTY_ID; static final String JSON_PROPERTY_USERNAME; static final String JSON_PROPERTY_FIRST_NAME; static final String JSON_PROPERTY_LAST_NAME; static final String JSON_PROPERTY_EMAIL; static final String JSON_PROPERTY_PASSWORD; static final String JSON_PROPERTY_PHONE; static final String JSON_PROPERTY_USER_STATUS; } |
@Test public void usernameTest() { } | public User username(String username) { this.username = username; return this; } | User { public User username(String username) { this.username = username; return this; } } | User { public User username(String username) { this.username = username; return this; } } | User { public User username(String username) { this.username = username; return this; } User id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); User username(String username); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_USERNAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getUsername(); void setUsername(String username); User firstName(String firstName); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_FIRST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getFirstName(); void setFirstName(String firstName); User lastName(String lastName); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_LAST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getLastName(); void setLastName(String lastName); User email(String email); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_EMAIL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getEmail(); void setEmail(String email); User password(String password); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PASSWORD) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getPassword(); void setPassword(String password); User phone(String phone); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PHONE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getPhone(); void setPhone(String phone); User userStatus(Integer userStatus); @javax.annotation.Nullable @ApiModelProperty(value = "User Status") @JsonProperty(JSON_PROPERTY_USER_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getUserStatus(); void setUserStatus(Integer userStatus); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); } | User { public User username(String username) { this.username = username; return this; } User id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); User username(String username); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_USERNAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getUsername(); void setUsername(String username); User firstName(String firstName); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_FIRST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getFirstName(); void setFirstName(String firstName); User lastName(String lastName); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_LAST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getLastName(); void setLastName(String lastName); User email(String email); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_EMAIL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getEmail(); void setEmail(String email); User password(String password); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PASSWORD) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getPassword(); void setPassword(String password); User phone(String phone); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PHONE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getPhone(); void setPhone(String phone); User userStatus(Integer userStatus); @javax.annotation.Nullable @ApiModelProperty(value = "User Status") @JsonProperty(JSON_PROPERTY_USER_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getUserStatus(); void setUserStatus(Integer userStatus); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String JSON_PROPERTY_ID; static final String JSON_PROPERTY_USERNAME; static final String JSON_PROPERTY_FIRST_NAME; static final String JSON_PROPERTY_LAST_NAME; static final String JSON_PROPERTY_EMAIL; static final String JSON_PROPERTY_PASSWORD; static final String JSON_PROPERTY_PHONE; static final String JSON_PROPERTY_USER_STATUS; } |
@Test public void firstNameTest() { } | public User firstName(String firstName) { this.firstName = firstName; return this; } | User { public User firstName(String firstName) { this.firstName = firstName; return this; } } | User { public User firstName(String firstName) { this.firstName = firstName; return this; } } | User { public User firstName(String firstName) { this.firstName = firstName; return this; } User id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); User username(String username); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_USERNAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getUsername(); void setUsername(String username); User firstName(String firstName); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_FIRST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getFirstName(); void setFirstName(String firstName); User lastName(String lastName); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_LAST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getLastName(); void setLastName(String lastName); User email(String email); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_EMAIL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getEmail(); void setEmail(String email); User password(String password); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PASSWORD) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getPassword(); void setPassword(String password); User phone(String phone); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PHONE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getPhone(); void setPhone(String phone); User userStatus(Integer userStatus); @javax.annotation.Nullable @ApiModelProperty(value = "User Status") @JsonProperty(JSON_PROPERTY_USER_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getUserStatus(); void setUserStatus(Integer userStatus); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); } | User { public User firstName(String firstName) { this.firstName = firstName; return this; } User id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); User username(String username); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_USERNAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getUsername(); void setUsername(String username); User firstName(String firstName); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_FIRST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getFirstName(); void setFirstName(String firstName); User lastName(String lastName); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_LAST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getLastName(); void setLastName(String lastName); User email(String email); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_EMAIL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getEmail(); void setEmail(String email); User password(String password); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PASSWORD) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getPassword(); void setPassword(String password); User phone(String phone); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PHONE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getPhone(); void setPhone(String phone); User userStatus(Integer userStatus); @javax.annotation.Nullable @ApiModelProperty(value = "User Status") @JsonProperty(JSON_PROPERTY_USER_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getUserStatus(); void setUserStatus(Integer userStatus); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String JSON_PROPERTY_ID; static final String JSON_PROPERTY_USERNAME; static final String JSON_PROPERTY_FIRST_NAME; static final String JSON_PROPERTY_LAST_NAME; static final String JSON_PROPERTY_EMAIL; static final String JSON_PROPERTY_PASSWORD; static final String JSON_PROPERTY_PHONE; static final String JSON_PROPERTY_USER_STATUS; } |
@Test public void lastNameTest() { } | public User lastName(String lastName) { this.lastName = lastName; return this; } | User { public User lastName(String lastName) { this.lastName = lastName; return this; } } | User { public User lastName(String lastName) { this.lastName = lastName; return this; } } | User { public User lastName(String lastName) { this.lastName = lastName; return this; } User id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); User username(String username); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_USERNAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getUsername(); void setUsername(String username); User firstName(String firstName); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_FIRST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getFirstName(); void setFirstName(String firstName); User lastName(String lastName); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_LAST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getLastName(); void setLastName(String lastName); User email(String email); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_EMAIL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getEmail(); void setEmail(String email); User password(String password); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PASSWORD) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getPassword(); void setPassword(String password); User phone(String phone); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PHONE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getPhone(); void setPhone(String phone); User userStatus(Integer userStatus); @javax.annotation.Nullable @ApiModelProperty(value = "User Status") @JsonProperty(JSON_PROPERTY_USER_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getUserStatus(); void setUserStatus(Integer userStatus); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); } | User { public User lastName(String lastName) { this.lastName = lastName; return this; } User id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); User username(String username); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_USERNAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getUsername(); void setUsername(String username); User firstName(String firstName); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_FIRST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getFirstName(); void setFirstName(String firstName); User lastName(String lastName); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_LAST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getLastName(); void setLastName(String lastName); User email(String email); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_EMAIL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getEmail(); void setEmail(String email); User password(String password); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PASSWORD) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getPassword(); void setPassword(String password); User phone(String phone); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PHONE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getPhone(); void setPhone(String phone); User userStatus(Integer userStatus); @javax.annotation.Nullable @ApiModelProperty(value = "User Status") @JsonProperty(JSON_PROPERTY_USER_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getUserStatus(); void setUserStatus(Integer userStatus); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String JSON_PROPERTY_ID; static final String JSON_PROPERTY_USERNAME; static final String JSON_PROPERTY_FIRST_NAME; static final String JSON_PROPERTY_LAST_NAME; static final String JSON_PROPERTY_EMAIL; static final String JSON_PROPERTY_PASSWORD; static final String JSON_PROPERTY_PHONE; static final String JSON_PROPERTY_USER_STATUS; } |
@Test public void emailTest() { } | public User email(String email) { this.email = email; return this; } | User { public User email(String email) { this.email = email; return this; } } | User { public User email(String email) { this.email = email; return this; } } | User { public User email(String email) { this.email = email; return this; } User id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); User username(String username); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_USERNAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getUsername(); void setUsername(String username); User firstName(String firstName); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_FIRST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getFirstName(); void setFirstName(String firstName); User lastName(String lastName); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_LAST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getLastName(); void setLastName(String lastName); User email(String email); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_EMAIL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getEmail(); void setEmail(String email); User password(String password); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PASSWORD) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getPassword(); void setPassword(String password); User phone(String phone); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PHONE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getPhone(); void setPhone(String phone); User userStatus(Integer userStatus); @javax.annotation.Nullable @ApiModelProperty(value = "User Status") @JsonProperty(JSON_PROPERTY_USER_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getUserStatus(); void setUserStatus(Integer userStatus); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); } | User { public User email(String email) { this.email = email; return this; } User id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); User username(String username); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_USERNAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getUsername(); void setUsername(String username); User firstName(String firstName); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_FIRST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getFirstName(); void setFirstName(String firstName); User lastName(String lastName); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_LAST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getLastName(); void setLastName(String lastName); User email(String email); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_EMAIL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getEmail(); void setEmail(String email); User password(String password); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PASSWORD) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getPassword(); void setPassword(String password); User phone(String phone); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PHONE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getPhone(); void setPhone(String phone); User userStatus(Integer userStatus); @javax.annotation.Nullable @ApiModelProperty(value = "User Status") @JsonProperty(JSON_PROPERTY_USER_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getUserStatus(); void setUserStatus(Integer userStatus); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String JSON_PROPERTY_ID; static final String JSON_PROPERTY_USERNAME; static final String JSON_PROPERTY_FIRST_NAME; static final String JSON_PROPERTY_LAST_NAME; static final String JSON_PROPERTY_EMAIL; static final String JSON_PROPERTY_PASSWORD; static final String JSON_PROPERTY_PHONE; static final String JSON_PROPERTY_USER_STATUS; } |
@Test public void passwordTest() { } | public User password(String password) { this.password = password; return this; } | User { public User password(String password) { this.password = password; return this; } } | User { public User password(String password) { this.password = password; return this; } } | User { public User password(String password) { this.password = password; return this; } User id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); User username(String username); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_USERNAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getUsername(); void setUsername(String username); User firstName(String firstName); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_FIRST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getFirstName(); void setFirstName(String firstName); User lastName(String lastName); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_LAST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getLastName(); void setLastName(String lastName); User email(String email); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_EMAIL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getEmail(); void setEmail(String email); User password(String password); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PASSWORD) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getPassword(); void setPassword(String password); User phone(String phone); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PHONE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getPhone(); void setPhone(String phone); User userStatus(Integer userStatus); @javax.annotation.Nullable @ApiModelProperty(value = "User Status") @JsonProperty(JSON_PROPERTY_USER_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getUserStatus(); void setUserStatus(Integer userStatus); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); } | User { public User password(String password) { this.password = password; return this; } User id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); User username(String username); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_USERNAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getUsername(); void setUsername(String username); User firstName(String firstName); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_FIRST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getFirstName(); void setFirstName(String firstName); User lastName(String lastName); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_LAST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getLastName(); void setLastName(String lastName); User email(String email); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_EMAIL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getEmail(); void setEmail(String email); User password(String password); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PASSWORD) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getPassword(); void setPassword(String password); User phone(String phone); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PHONE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getPhone(); void setPhone(String phone); User userStatus(Integer userStatus); @javax.annotation.Nullable @ApiModelProperty(value = "User Status") @JsonProperty(JSON_PROPERTY_USER_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getUserStatus(); void setUserStatus(Integer userStatus); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String JSON_PROPERTY_ID; static final String JSON_PROPERTY_USERNAME; static final String JSON_PROPERTY_FIRST_NAME; static final String JSON_PROPERTY_LAST_NAME; static final String JSON_PROPERTY_EMAIL; static final String JSON_PROPERTY_PASSWORD; static final String JSON_PROPERTY_PHONE; static final String JSON_PROPERTY_USER_STATUS; } |
@Test public void phoneTest() { } | public User phone(String phone) { this.phone = phone; return this; } | User { public User phone(String phone) { this.phone = phone; return this; } } | User { public User phone(String phone) { this.phone = phone; return this; } } | User { public User phone(String phone) { this.phone = phone; return this; } User id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); User username(String username); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_USERNAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getUsername(); void setUsername(String username); User firstName(String firstName); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_FIRST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getFirstName(); void setFirstName(String firstName); User lastName(String lastName); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_LAST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getLastName(); void setLastName(String lastName); User email(String email); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_EMAIL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getEmail(); void setEmail(String email); User password(String password); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PASSWORD) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getPassword(); void setPassword(String password); User phone(String phone); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PHONE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getPhone(); void setPhone(String phone); User userStatus(Integer userStatus); @javax.annotation.Nullable @ApiModelProperty(value = "User Status") @JsonProperty(JSON_PROPERTY_USER_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getUserStatus(); void setUserStatus(Integer userStatus); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); } | User { public User phone(String phone) { this.phone = phone; return this; } User id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); User username(String username); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_USERNAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getUsername(); void setUsername(String username); User firstName(String firstName); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_FIRST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getFirstName(); void setFirstName(String firstName); User lastName(String lastName); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_LAST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getLastName(); void setLastName(String lastName); User email(String email); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_EMAIL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getEmail(); void setEmail(String email); User password(String password); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PASSWORD) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getPassword(); void setPassword(String password); User phone(String phone); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PHONE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getPhone(); void setPhone(String phone); User userStatus(Integer userStatus); @javax.annotation.Nullable @ApiModelProperty(value = "User Status") @JsonProperty(JSON_PROPERTY_USER_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getUserStatus(); void setUserStatus(Integer userStatus); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String JSON_PROPERTY_ID; static final String JSON_PROPERTY_USERNAME; static final String JSON_PROPERTY_FIRST_NAME; static final String JSON_PROPERTY_LAST_NAME; static final String JSON_PROPERTY_EMAIL; static final String JSON_PROPERTY_PASSWORD; static final String JSON_PROPERTY_PHONE; static final String JSON_PROPERTY_USER_STATUS; } |
@Test public void userStatusTest() { } | public User userStatus(Integer userStatus) { this.userStatus = userStatus; return this; } | User { public User userStatus(Integer userStatus) { this.userStatus = userStatus; return this; } } | User { public User userStatus(Integer userStatus) { this.userStatus = userStatus; return this; } } | User { public User userStatus(Integer userStatus) { this.userStatus = userStatus; return this; } User id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); User username(String username); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_USERNAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getUsername(); void setUsername(String username); User firstName(String firstName); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_FIRST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getFirstName(); void setFirstName(String firstName); User lastName(String lastName); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_LAST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getLastName(); void setLastName(String lastName); User email(String email); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_EMAIL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getEmail(); void setEmail(String email); User password(String password); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PASSWORD) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getPassword(); void setPassword(String password); User phone(String phone); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PHONE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getPhone(); void setPhone(String phone); User userStatus(Integer userStatus); @javax.annotation.Nullable @ApiModelProperty(value = "User Status") @JsonProperty(JSON_PROPERTY_USER_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getUserStatus(); void setUserStatus(Integer userStatus); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); } | User { public User userStatus(Integer userStatus) { this.userStatus = userStatus; return this; } User id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); User username(String username); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_USERNAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getUsername(); void setUsername(String username); User firstName(String firstName); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_FIRST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getFirstName(); void setFirstName(String firstName); User lastName(String lastName); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_LAST_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getLastName(); void setLastName(String lastName); User email(String email); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_EMAIL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getEmail(); void setEmail(String email); User password(String password); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PASSWORD) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getPassword(); void setPassword(String password); User phone(String phone); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PHONE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getPhone(); void setPhone(String phone); User userStatus(Integer userStatus); @javax.annotation.Nullable @ApiModelProperty(value = "User Status") @JsonProperty(JSON_PROPERTY_USER_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getUserStatus(); void setUserStatus(Integer userStatus); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String JSON_PROPERTY_ID; static final String JSON_PROPERTY_USERNAME; static final String JSON_PROPERTY_FIRST_NAME; static final String JSON_PROPERTY_LAST_NAME; static final String JSON_PROPERTY_EMAIL; static final String JSON_PROPERTY_PASSWORD; static final String JSON_PROPERTY_PHONE; static final String JSON_PROPERTY_USER_STATUS; } |
@Test public void idTest() { } | public Pet id(Long id) { this.id = id; return this; } | Pet { public Pet id(Long id) { this.id = id; return this; } } | Pet { public Pet id(Long id) { this.id = id; return this; } } | Pet { public Pet id(Long id) { this.id = id; return this; } Pet id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Pet category(Category category); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_CATEGORY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Category getCategory(); void setCategory(Category category); Pet name(String name); @ApiModelProperty(example = "doggie", required = true, value = "") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.ALWAYS) String getName(); void setName(String name); Pet photoUrls(List<String> photoUrls); Pet addPhotoUrlsItem(String photoUrlsItem); @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_PHOTO_URLS) @JsonInclude(value = JsonInclude.Include.ALWAYS) List<String> getPhotoUrls(); void setPhotoUrls(List<String> photoUrls); Pet tags(List<Tag> tags); Pet addTagsItem(Tag tagsItem); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_TAGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) List<Tag> getTags(); void setTags(List<Tag> tags); Pet status(StatusEnum status); @javax.annotation.Nullable @ApiModelProperty(value = "pet status in the store") @JsonProperty(JSON_PROPERTY_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) StatusEnum getStatus(); void setStatus(StatusEnum status); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); } | Pet { public Pet id(Long id) { this.id = id; return this; } Pet id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Pet category(Category category); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_CATEGORY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Category getCategory(); void setCategory(Category category); Pet name(String name); @ApiModelProperty(example = "doggie", required = true, value = "") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.ALWAYS) String getName(); void setName(String name); Pet photoUrls(List<String> photoUrls); Pet addPhotoUrlsItem(String photoUrlsItem); @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_PHOTO_URLS) @JsonInclude(value = JsonInclude.Include.ALWAYS) List<String> getPhotoUrls(); void setPhotoUrls(List<String> photoUrls); Pet tags(List<Tag> tags); Pet addTagsItem(Tag tagsItem); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_TAGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) List<Tag> getTags(); void setTags(List<Tag> tags); Pet status(StatusEnum status); @javax.annotation.Nullable @ApiModelProperty(value = "pet status in the store") @JsonProperty(JSON_PROPERTY_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) StatusEnum getStatus(); void setStatus(StatusEnum status); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String JSON_PROPERTY_ID; static final String JSON_PROPERTY_CATEGORY; static final String JSON_PROPERTY_NAME; static final String JSON_PROPERTY_PHOTO_URLS; static final String JSON_PROPERTY_TAGS; static final String JSON_PROPERTY_STATUS; } |
@Test public void whenFilterEmployees_thenGetFilteredStream() { Integer[] empIds = { 1, 2, 3, 4 }; List<Employee> employees = Stream.of(empIds) .map(employeeRepository::findById) .filter(e -> e != null) .filter(e -> e.getSalary() > 200000) .collect(Collectors.toList()); assertEquals(Arrays.asList(arrayOfEmps[2]), employees); } | public Double getSalary() { return salary; } | Employee { public Double getSalary() { return salary; } } | Employee { public Double getSalary() { return salary; } Employee(Integer id, String name, Double salary); } | Employee { public Double getSalary() { return salary; } Employee(Integer id, String name, Double salary); Integer getId(); void setId(Integer id); String getName(); void setName(String name); Double getSalary(); void setSalary(Double salary); void salaryIncrement(Double percentage); String toString(); } | Employee { public Double getSalary() { return salary; } Employee(Integer id, String name, Double salary); Integer getId(); void setId(Integer id); String getName(); void setName(String name); Double getSalary(); void setSalary(Double salary); void salaryIncrement(Double percentage); String toString(); } |
@Test public void categoryTest() { } | public Pet category(Category category) { this.category = category; return this; } | Pet { public Pet category(Category category) { this.category = category; return this; } } | Pet { public Pet category(Category category) { this.category = category; return this; } } | Pet { public Pet category(Category category) { this.category = category; return this; } Pet id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Pet category(Category category); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_CATEGORY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Category getCategory(); void setCategory(Category category); Pet name(String name); @ApiModelProperty(example = "doggie", required = true, value = "") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.ALWAYS) String getName(); void setName(String name); Pet photoUrls(List<String> photoUrls); Pet addPhotoUrlsItem(String photoUrlsItem); @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_PHOTO_URLS) @JsonInclude(value = JsonInclude.Include.ALWAYS) List<String> getPhotoUrls(); void setPhotoUrls(List<String> photoUrls); Pet tags(List<Tag> tags); Pet addTagsItem(Tag tagsItem); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_TAGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) List<Tag> getTags(); void setTags(List<Tag> tags); Pet status(StatusEnum status); @javax.annotation.Nullable @ApiModelProperty(value = "pet status in the store") @JsonProperty(JSON_PROPERTY_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) StatusEnum getStatus(); void setStatus(StatusEnum status); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); } | Pet { public Pet category(Category category) { this.category = category; return this; } Pet id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Pet category(Category category); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_CATEGORY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Category getCategory(); void setCategory(Category category); Pet name(String name); @ApiModelProperty(example = "doggie", required = true, value = "") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.ALWAYS) String getName(); void setName(String name); Pet photoUrls(List<String> photoUrls); Pet addPhotoUrlsItem(String photoUrlsItem); @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_PHOTO_URLS) @JsonInclude(value = JsonInclude.Include.ALWAYS) List<String> getPhotoUrls(); void setPhotoUrls(List<String> photoUrls); Pet tags(List<Tag> tags); Pet addTagsItem(Tag tagsItem); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_TAGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) List<Tag> getTags(); void setTags(List<Tag> tags); Pet status(StatusEnum status); @javax.annotation.Nullable @ApiModelProperty(value = "pet status in the store") @JsonProperty(JSON_PROPERTY_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) StatusEnum getStatus(); void setStatus(StatusEnum status); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String JSON_PROPERTY_ID; static final String JSON_PROPERTY_CATEGORY; static final String JSON_PROPERTY_NAME; static final String JSON_PROPERTY_PHOTO_URLS; static final String JSON_PROPERTY_TAGS; static final String JSON_PROPERTY_STATUS; } |
@Test public void nameTest() { } | public Pet name(String name) { this.name = name; return this; } | Pet { public Pet name(String name) { this.name = name; return this; } } | Pet { public Pet name(String name) { this.name = name; return this; } } | Pet { public Pet name(String name) { this.name = name; return this; } Pet id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Pet category(Category category); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_CATEGORY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Category getCategory(); void setCategory(Category category); Pet name(String name); @ApiModelProperty(example = "doggie", required = true, value = "") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.ALWAYS) String getName(); void setName(String name); Pet photoUrls(List<String> photoUrls); Pet addPhotoUrlsItem(String photoUrlsItem); @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_PHOTO_URLS) @JsonInclude(value = JsonInclude.Include.ALWAYS) List<String> getPhotoUrls(); void setPhotoUrls(List<String> photoUrls); Pet tags(List<Tag> tags); Pet addTagsItem(Tag tagsItem); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_TAGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) List<Tag> getTags(); void setTags(List<Tag> tags); Pet status(StatusEnum status); @javax.annotation.Nullable @ApiModelProperty(value = "pet status in the store") @JsonProperty(JSON_PROPERTY_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) StatusEnum getStatus(); void setStatus(StatusEnum status); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); } | Pet { public Pet name(String name) { this.name = name; return this; } Pet id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Pet category(Category category); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_CATEGORY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Category getCategory(); void setCategory(Category category); Pet name(String name); @ApiModelProperty(example = "doggie", required = true, value = "") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.ALWAYS) String getName(); void setName(String name); Pet photoUrls(List<String> photoUrls); Pet addPhotoUrlsItem(String photoUrlsItem); @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_PHOTO_URLS) @JsonInclude(value = JsonInclude.Include.ALWAYS) List<String> getPhotoUrls(); void setPhotoUrls(List<String> photoUrls); Pet tags(List<Tag> tags); Pet addTagsItem(Tag tagsItem); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_TAGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) List<Tag> getTags(); void setTags(List<Tag> tags); Pet status(StatusEnum status); @javax.annotation.Nullable @ApiModelProperty(value = "pet status in the store") @JsonProperty(JSON_PROPERTY_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) StatusEnum getStatus(); void setStatus(StatusEnum status); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String JSON_PROPERTY_ID; static final String JSON_PROPERTY_CATEGORY; static final String JSON_PROPERTY_NAME; static final String JSON_PROPERTY_PHOTO_URLS; static final String JSON_PROPERTY_TAGS; static final String JSON_PROPERTY_STATUS; } |
@Test public void photoUrlsTest() { } | public Pet photoUrls(List<String> photoUrls) { this.photoUrls = photoUrls; return this; } | Pet { public Pet photoUrls(List<String> photoUrls) { this.photoUrls = photoUrls; return this; } } | Pet { public Pet photoUrls(List<String> photoUrls) { this.photoUrls = photoUrls; return this; } } | Pet { public Pet photoUrls(List<String> photoUrls) { this.photoUrls = photoUrls; return this; } Pet id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Pet category(Category category); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_CATEGORY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Category getCategory(); void setCategory(Category category); Pet name(String name); @ApiModelProperty(example = "doggie", required = true, value = "") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.ALWAYS) String getName(); void setName(String name); Pet photoUrls(List<String> photoUrls); Pet addPhotoUrlsItem(String photoUrlsItem); @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_PHOTO_URLS) @JsonInclude(value = JsonInclude.Include.ALWAYS) List<String> getPhotoUrls(); void setPhotoUrls(List<String> photoUrls); Pet tags(List<Tag> tags); Pet addTagsItem(Tag tagsItem); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_TAGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) List<Tag> getTags(); void setTags(List<Tag> tags); Pet status(StatusEnum status); @javax.annotation.Nullable @ApiModelProperty(value = "pet status in the store") @JsonProperty(JSON_PROPERTY_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) StatusEnum getStatus(); void setStatus(StatusEnum status); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); } | Pet { public Pet photoUrls(List<String> photoUrls) { this.photoUrls = photoUrls; return this; } Pet id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Pet category(Category category); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_CATEGORY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Category getCategory(); void setCategory(Category category); Pet name(String name); @ApiModelProperty(example = "doggie", required = true, value = "") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.ALWAYS) String getName(); void setName(String name); Pet photoUrls(List<String> photoUrls); Pet addPhotoUrlsItem(String photoUrlsItem); @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_PHOTO_URLS) @JsonInclude(value = JsonInclude.Include.ALWAYS) List<String> getPhotoUrls(); void setPhotoUrls(List<String> photoUrls); Pet tags(List<Tag> tags); Pet addTagsItem(Tag tagsItem); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_TAGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) List<Tag> getTags(); void setTags(List<Tag> tags); Pet status(StatusEnum status); @javax.annotation.Nullable @ApiModelProperty(value = "pet status in the store") @JsonProperty(JSON_PROPERTY_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) StatusEnum getStatus(); void setStatus(StatusEnum status); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String JSON_PROPERTY_ID; static final String JSON_PROPERTY_CATEGORY; static final String JSON_PROPERTY_NAME; static final String JSON_PROPERTY_PHOTO_URLS; static final String JSON_PROPERTY_TAGS; static final String JSON_PROPERTY_STATUS; } |
@Test public void tagsTest() { } | public Pet tags(List<Tag> tags) { this.tags = tags; return this; } | Pet { public Pet tags(List<Tag> tags) { this.tags = tags; return this; } } | Pet { public Pet tags(List<Tag> tags) { this.tags = tags; return this; } } | Pet { public Pet tags(List<Tag> tags) { this.tags = tags; return this; } Pet id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Pet category(Category category); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_CATEGORY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Category getCategory(); void setCategory(Category category); Pet name(String name); @ApiModelProperty(example = "doggie", required = true, value = "") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.ALWAYS) String getName(); void setName(String name); Pet photoUrls(List<String> photoUrls); Pet addPhotoUrlsItem(String photoUrlsItem); @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_PHOTO_URLS) @JsonInclude(value = JsonInclude.Include.ALWAYS) List<String> getPhotoUrls(); void setPhotoUrls(List<String> photoUrls); Pet tags(List<Tag> tags); Pet addTagsItem(Tag tagsItem); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_TAGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) List<Tag> getTags(); void setTags(List<Tag> tags); Pet status(StatusEnum status); @javax.annotation.Nullable @ApiModelProperty(value = "pet status in the store") @JsonProperty(JSON_PROPERTY_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) StatusEnum getStatus(); void setStatus(StatusEnum status); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); } | Pet { public Pet tags(List<Tag> tags) { this.tags = tags; return this; } Pet id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Pet category(Category category); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_CATEGORY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Category getCategory(); void setCategory(Category category); Pet name(String name); @ApiModelProperty(example = "doggie", required = true, value = "") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.ALWAYS) String getName(); void setName(String name); Pet photoUrls(List<String> photoUrls); Pet addPhotoUrlsItem(String photoUrlsItem); @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_PHOTO_URLS) @JsonInclude(value = JsonInclude.Include.ALWAYS) List<String> getPhotoUrls(); void setPhotoUrls(List<String> photoUrls); Pet tags(List<Tag> tags); Pet addTagsItem(Tag tagsItem); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_TAGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) List<Tag> getTags(); void setTags(List<Tag> tags); Pet status(StatusEnum status); @javax.annotation.Nullable @ApiModelProperty(value = "pet status in the store") @JsonProperty(JSON_PROPERTY_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) StatusEnum getStatus(); void setStatus(StatusEnum status); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String JSON_PROPERTY_ID; static final String JSON_PROPERTY_CATEGORY; static final String JSON_PROPERTY_NAME; static final String JSON_PROPERTY_PHOTO_URLS; static final String JSON_PROPERTY_TAGS; static final String JSON_PROPERTY_STATUS; } |
@Test public void statusTest() { } | public Pet status(StatusEnum status) { this.status = status; return this; } | Pet { public Pet status(StatusEnum status) { this.status = status; return this; } } | Pet { public Pet status(StatusEnum status) { this.status = status; return this; } } | Pet { public Pet status(StatusEnum status) { this.status = status; return this; } Pet id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Pet category(Category category); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_CATEGORY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Category getCategory(); void setCategory(Category category); Pet name(String name); @ApiModelProperty(example = "doggie", required = true, value = "") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.ALWAYS) String getName(); void setName(String name); Pet photoUrls(List<String> photoUrls); Pet addPhotoUrlsItem(String photoUrlsItem); @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_PHOTO_URLS) @JsonInclude(value = JsonInclude.Include.ALWAYS) List<String> getPhotoUrls(); void setPhotoUrls(List<String> photoUrls); Pet tags(List<Tag> tags); Pet addTagsItem(Tag tagsItem); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_TAGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) List<Tag> getTags(); void setTags(List<Tag> tags); Pet status(StatusEnum status); @javax.annotation.Nullable @ApiModelProperty(value = "pet status in the store") @JsonProperty(JSON_PROPERTY_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) StatusEnum getStatus(); void setStatus(StatusEnum status); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); } | Pet { public Pet status(StatusEnum status) { this.status = status; return this; } Pet id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Pet category(Category category); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_CATEGORY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Category getCategory(); void setCategory(Category category); Pet name(String name); @ApiModelProperty(example = "doggie", required = true, value = "") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.ALWAYS) String getName(); void setName(String name); Pet photoUrls(List<String> photoUrls); Pet addPhotoUrlsItem(String photoUrlsItem); @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_PHOTO_URLS) @JsonInclude(value = JsonInclude.Include.ALWAYS) List<String> getPhotoUrls(); void setPhotoUrls(List<String> photoUrls); Pet tags(List<Tag> tags); Pet addTagsItem(Tag tagsItem); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_TAGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) List<Tag> getTags(); void setTags(List<Tag> tags); Pet status(StatusEnum status); @javax.annotation.Nullable @ApiModelProperty(value = "pet status in the store") @JsonProperty(JSON_PROPERTY_STATUS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) StatusEnum getStatus(); void setStatus(StatusEnum status); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String JSON_PROPERTY_ID; static final String JSON_PROPERTY_CATEGORY; static final String JSON_PROPERTY_NAME; static final String JSON_PROPERTY_PHOTO_URLS; static final String JSON_PROPERTY_TAGS; static final String JSON_PROPERTY_STATUS; } |
@Test public void idTest() { } | public Category id(Long id) { this.id = id; return this; } | Category { public Category id(Long id) { this.id = id; return this; } } | Category { public Category id(Long id) { this.id = id; return this; } } | Category { public Category id(Long id) { this.id = id; return this; } Category id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Category name(String name); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getName(); void setName(String name); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); } | Category { public Category id(Long id) { this.id = id; return this; } Category id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Category name(String name); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getName(); void setName(String name); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String JSON_PROPERTY_ID; static final String JSON_PROPERTY_NAME; } |
@Test public void nameTest() { } | public Category name(String name) { this.name = name; return this; } | Category { public Category name(String name) { this.name = name; return this; } } | Category { public Category name(String name) { this.name = name; return this; } } | Category { public Category name(String name) { this.name = name; return this; } Category id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Category name(String name); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getName(); void setName(String name); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); } | Category { public Category name(String name) { this.name = name; return this; } Category id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Category name(String name); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getName(); void setName(String name); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String JSON_PROPERTY_ID; static final String JSON_PROPERTY_NAME; } |
@Test public void codeTest() { } | public ModelApiResponse code(Integer code) { this.code = code; return this; } | ModelApiResponse { public ModelApiResponse code(Integer code) { this.code = code; return this; } } | ModelApiResponse { public ModelApiResponse code(Integer code) { this.code = code; return this; } } | ModelApiResponse { public ModelApiResponse code(Integer code) { this.code = code; return this; } ModelApiResponse code(Integer code); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_CODE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getCode(); void setCode(Integer code); ModelApiResponse type(String type); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getType(); void setType(String type); ModelApiResponse message(String message); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_MESSAGE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getMessage(); void setMessage(String message); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); } | ModelApiResponse { public ModelApiResponse code(Integer code) { this.code = code; return this; } ModelApiResponse code(Integer code); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_CODE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getCode(); void setCode(Integer code); ModelApiResponse type(String type); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getType(); void setType(String type); ModelApiResponse message(String message); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_MESSAGE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getMessage(); void setMessage(String message); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String JSON_PROPERTY_CODE; static final String JSON_PROPERTY_TYPE; static final String JSON_PROPERTY_MESSAGE; } |
@Test public void typeTest() { } | public ModelApiResponse type(String type) { this.type = type; return this; } | ModelApiResponse { public ModelApiResponse type(String type) { this.type = type; return this; } } | ModelApiResponse { public ModelApiResponse type(String type) { this.type = type; return this; } } | ModelApiResponse { public ModelApiResponse type(String type) { this.type = type; return this; } ModelApiResponse code(Integer code); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_CODE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getCode(); void setCode(Integer code); ModelApiResponse type(String type); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getType(); void setType(String type); ModelApiResponse message(String message); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_MESSAGE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getMessage(); void setMessage(String message); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); } | ModelApiResponse { public ModelApiResponse type(String type) { this.type = type; return this; } ModelApiResponse code(Integer code); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_CODE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getCode(); void setCode(Integer code); ModelApiResponse type(String type); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getType(); void setType(String type); ModelApiResponse message(String message); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_MESSAGE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getMessage(); void setMessage(String message); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String JSON_PROPERTY_CODE; static final String JSON_PROPERTY_TYPE; static final String JSON_PROPERTY_MESSAGE; } |
@Test public void messageTest() { } | public ModelApiResponse message(String message) { this.message = message; return this; } | ModelApiResponse { public ModelApiResponse message(String message) { this.message = message; return this; } } | ModelApiResponse { public ModelApiResponse message(String message) { this.message = message; return this; } } | ModelApiResponse { public ModelApiResponse message(String message) { this.message = message; return this; } ModelApiResponse code(Integer code); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_CODE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getCode(); void setCode(Integer code); ModelApiResponse type(String type); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getType(); void setType(String type); ModelApiResponse message(String message); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_MESSAGE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getMessage(); void setMessage(String message); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); } | ModelApiResponse { public ModelApiResponse message(String message) { this.message = message; return this; } ModelApiResponse code(Integer code); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_CODE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Integer getCode(); void setCode(Integer code); ModelApiResponse type(String type); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_TYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getType(); void setType(String type); ModelApiResponse message(String message); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_MESSAGE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getMessage(); void setMessage(String message); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String JSON_PROPERTY_CODE; static final String JSON_PROPERTY_TYPE; static final String JSON_PROPERTY_MESSAGE; } |
@Test public void whenFindFirst_thenGetFirstEmployeeInStream() { Integer[] empIds = { 1, 2, 3, 4 }; Employee employee = Stream.of(empIds) .map(employeeRepository::findById) .filter(e -> e != null) .filter(e -> e.getSalary() > 100000) .findFirst() .orElse(null); assertEquals(employee.getSalary(), new Double(200000)); } | public Double getSalary() { return salary; } | Employee { public Double getSalary() { return salary; } } | Employee { public Double getSalary() { return salary; } Employee(Integer id, String name, Double salary); } | Employee { public Double getSalary() { return salary; } Employee(Integer id, String name, Double salary); Integer getId(); void setId(Integer id); String getName(); void setName(String name); Double getSalary(); void setSalary(Double salary); void salaryIncrement(Double percentage); String toString(); } | Employee { public Double getSalary() { return salary; } Employee(Integer id, String name, Double salary); Integer getId(); void setId(Integer id); String getName(); void setName(String name); Double getSalary(); void setSalary(Double salary); void salaryIncrement(Double percentage); String toString(); } |
@Test public void idTest() { } | public Tag id(Long id) { this.id = id; return this; } | Tag { public Tag id(Long id) { this.id = id; return this; } } | Tag { public Tag id(Long id) { this.id = id; return this; } } | Tag { public Tag id(Long id) { this.id = id; return this; } Tag id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Tag name(String name); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getName(); void setName(String name); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); } | Tag { public Tag id(Long id) { this.id = id; return this; } Tag id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Tag name(String name); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getName(); void setName(String name); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String JSON_PROPERTY_ID; static final String JSON_PROPERTY_NAME; } |
@Test public void nameTest() { } | public Tag name(String name) { this.name = name; return this; } | Tag { public Tag name(String name) { this.name = name; return this; } } | Tag { public Tag name(String name) { this.name = name; return this; } } | Tag { public Tag name(String name) { this.name = name; return this; } Tag id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Tag name(String name); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getName(); void setName(String name); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); } | Tag { public Tag name(String name) { this.name = name; return this; } Tag id(Long id); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ID) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) Long getId(); void setId(Long id); Tag name(String name); @javax.annotation.Nullable @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_NAME) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) String getName(); void setName(String name); @Override boolean equals(java.lang.Object o); @Override int hashCode(); @Override String toString(); static final String JSON_PROPERTY_ID; static final String JSON_PROPERTY_NAME; } |
@Test public void createUserTest() { User body = null; api.createUser(body); } | public void createUser(User body) throws RestClientException { createUserWithHttpInfo(body); } | UserApi { public void createUser(User body) throws RestClientException { createUserWithHttpInfo(body); } } | UserApi { public void createUser(User body) throws RestClientException { createUserWithHttpInfo(body); } UserApi(); @Autowired UserApi(ApiClient apiClient); } | UserApi { public void createUser(User body) throws RestClientException { createUserWithHttpInfo(body); } UserApi(); @Autowired UserApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void createUser(User body); ResponseEntity<Void> createUserWithHttpInfo(User body); void createUsersWithArrayInput(List<User> body); ResponseEntity<Void> createUsersWithArrayInputWithHttpInfo(List<User> body); void createUsersWithListInput(List<User> body); ResponseEntity<Void> createUsersWithListInputWithHttpInfo(List<User> body); void deleteUser(String username); ResponseEntity<Void> deleteUserWithHttpInfo(String username); User getUserByName(String username); ResponseEntity<User> getUserByNameWithHttpInfo(String username); String loginUser(String username, String password); ResponseEntity<String> loginUserWithHttpInfo(String username, String password); void logoutUser(); ResponseEntity<Void> logoutUserWithHttpInfo(); void updateUser(String username, User body); ResponseEntity<Void> updateUserWithHttpInfo(String username, User body); } | UserApi { public void createUser(User body) throws RestClientException { createUserWithHttpInfo(body); } UserApi(); @Autowired UserApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void createUser(User body); ResponseEntity<Void> createUserWithHttpInfo(User body); void createUsersWithArrayInput(List<User> body); ResponseEntity<Void> createUsersWithArrayInputWithHttpInfo(List<User> body); void createUsersWithListInput(List<User> body); ResponseEntity<Void> createUsersWithListInputWithHttpInfo(List<User> body); void deleteUser(String username); ResponseEntity<Void> deleteUserWithHttpInfo(String username); User getUserByName(String username); ResponseEntity<User> getUserByNameWithHttpInfo(String username); String loginUser(String username, String password); ResponseEntity<String> loginUserWithHttpInfo(String username, String password); void logoutUser(); ResponseEntity<Void> logoutUserWithHttpInfo(); void updateUser(String username, User body); ResponseEntity<Void> updateUserWithHttpInfo(String username, User body); } |
@Test public void createUsersWithArrayInputTest() { List<User> body = null; api.createUsersWithArrayInput(body); } | public void createUsersWithArrayInput(List<User> body) throws RestClientException { createUsersWithArrayInputWithHttpInfo(body); } | UserApi { public void createUsersWithArrayInput(List<User> body) throws RestClientException { createUsersWithArrayInputWithHttpInfo(body); } } | UserApi { public void createUsersWithArrayInput(List<User> body) throws RestClientException { createUsersWithArrayInputWithHttpInfo(body); } UserApi(); @Autowired UserApi(ApiClient apiClient); } | UserApi { public void createUsersWithArrayInput(List<User> body) throws RestClientException { createUsersWithArrayInputWithHttpInfo(body); } UserApi(); @Autowired UserApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void createUser(User body); ResponseEntity<Void> createUserWithHttpInfo(User body); void createUsersWithArrayInput(List<User> body); ResponseEntity<Void> createUsersWithArrayInputWithHttpInfo(List<User> body); void createUsersWithListInput(List<User> body); ResponseEntity<Void> createUsersWithListInputWithHttpInfo(List<User> body); void deleteUser(String username); ResponseEntity<Void> deleteUserWithHttpInfo(String username); User getUserByName(String username); ResponseEntity<User> getUserByNameWithHttpInfo(String username); String loginUser(String username, String password); ResponseEntity<String> loginUserWithHttpInfo(String username, String password); void logoutUser(); ResponseEntity<Void> logoutUserWithHttpInfo(); void updateUser(String username, User body); ResponseEntity<Void> updateUserWithHttpInfo(String username, User body); } | UserApi { public void createUsersWithArrayInput(List<User> body) throws RestClientException { createUsersWithArrayInputWithHttpInfo(body); } UserApi(); @Autowired UserApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void createUser(User body); ResponseEntity<Void> createUserWithHttpInfo(User body); void createUsersWithArrayInput(List<User> body); ResponseEntity<Void> createUsersWithArrayInputWithHttpInfo(List<User> body); void createUsersWithListInput(List<User> body); ResponseEntity<Void> createUsersWithListInputWithHttpInfo(List<User> body); void deleteUser(String username); ResponseEntity<Void> deleteUserWithHttpInfo(String username); User getUserByName(String username); ResponseEntity<User> getUserByNameWithHttpInfo(String username); String loginUser(String username, String password); ResponseEntity<String> loginUserWithHttpInfo(String username, String password); void logoutUser(); ResponseEntity<Void> logoutUserWithHttpInfo(); void updateUser(String username, User body); ResponseEntity<Void> updateUserWithHttpInfo(String username, User body); } |
@Test public void createUsersWithListInputTest() { List<User> body = null; api.createUsersWithListInput(body); } | public void createUsersWithListInput(List<User> body) throws RestClientException { createUsersWithListInputWithHttpInfo(body); } | UserApi { public void createUsersWithListInput(List<User> body) throws RestClientException { createUsersWithListInputWithHttpInfo(body); } } | UserApi { public void createUsersWithListInput(List<User> body) throws RestClientException { createUsersWithListInputWithHttpInfo(body); } UserApi(); @Autowired UserApi(ApiClient apiClient); } | UserApi { public void createUsersWithListInput(List<User> body) throws RestClientException { createUsersWithListInputWithHttpInfo(body); } UserApi(); @Autowired UserApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void createUser(User body); ResponseEntity<Void> createUserWithHttpInfo(User body); void createUsersWithArrayInput(List<User> body); ResponseEntity<Void> createUsersWithArrayInputWithHttpInfo(List<User> body); void createUsersWithListInput(List<User> body); ResponseEntity<Void> createUsersWithListInputWithHttpInfo(List<User> body); void deleteUser(String username); ResponseEntity<Void> deleteUserWithHttpInfo(String username); User getUserByName(String username); ResponseEntity<User> getUserByNameWithHttpInfo(String username); String loginUser(String username, String password); ResponseEntity<String> loginUserWithHttpInfo(String username, String password); void logoutUser(); ResponseEntity<Void> logoutUserWithHttpInfo(); void updateUser(String username, User body); ResponseEntity<Void> updateUserWithHttpInfo(String username, User body); } | UserApi { public void createUsersWithListInput(List<User> body) throws RestClientException { createUsersWithListInputWithHttpInfo(body); } UserApi(); @Autowired UserApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void createUser(User body); ResponseEntity<Void> createUserWithHttpInfo(User body); void createUsersWithArrayInput(List<User> body); ResponseEntity<Void> createUsersWithArrayInputWithHttpInfo(List<User> body); void createUsersWithListInput(List<User> body); ResponseEntity<Void> createUsersWithListInputWithHttpInfo(List<User> body); void deleteUser(String username); ResponseEntity<Void> deleteUserWithHttpInfo(String username); User getUserByName(String username); ResponseEntity<User> getUserByNameWithHttpInfo(String username); String loginUser(String username, String password); ResponseEntity<String> loginUserWithHttpInfo(String username, String password); void logoutUser(); ResponseEntity<Void> logoutUserWithHttpInfo(); void updateUser(String username, User body); ResponseEntity<Void> updateUserWithHttpInfo(String username, User body); } |
@Test public void deleteUserTest() { String username = null; api.deleteUser(username); } | public void deleteUser(String username) throws RestClientException { deleteUserWithHttpInfo(username); } | UserApi { public void deleteUser(String username) throws RestClientException { deleteUserWithHttpInfo(username); } } | UserApi { public void deleteUser(String username) throws RestClientException { deleteUserWithHttpInfo(username); } UserApi(); @Autowired UserApi(ApiClient apiClient); } | UserApi { public void deleteUser(String username) throws RestClientException { deleteUserWithHttpInfo(username); } UserApi(); @Autowired UserApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void createUser(User body); ResponseEntity<Void> createUserWithHttpInfo(User body); void createUsersWithArrayInput(List<User> body); ResponseEntity<Void> createUsersWithArrayInputWithHttpInfo(List<User> body); void createUsersWithListInput(List<User> body); ResponseEntity<Void> createUsersWithListInputWithHttpInfo(List<User> body); void deleteUser(String username); ResponseEntity<Void> deleteUserWithHttpInfo(String username); User getUserByName(String username); ResponseEntity<User> getUserByNameWithHttpInfo(String username); String loginUser(String username, String password); ResponseEntity<String> loginUserWithHttpInfo(String username, String password); void logoutUser(); ResponseEntity<Void> logoutUserWithHttpInfo(); void updateUser(String username, User body); ResponseEntity<Void> updateUserWithHttpInfo(String username, User body); } | UserApi { public void deleteUser(String username) throws RestClientException { deleteUserWithHttpInfo(username); } UserApi(); @Autowired UserApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void createUser(User body); ResponseEntity<Void> createUserWithHttpInfo(User body); void createUsersWithArrayInput(List<User> body); ResponseEntity<Void> createUsersWithArrayInputWithHttpInfo(List<User> body); void createUsersWithListInput(List<User> body); ResponseEntity<Void> createUsersWithListInputWithHttpInfo(List<User> body); void deleteUser(String username); ResponseEntity<Void> deleteUserWithHttpInfo(String username); User getUserByName(String username); ResponseEntity<User> getUserByNameWithHttpInfo(String username); String loginUser(String username, String password); ResponseEntity<String> loginUserWithHttpInfo(String username, String password); void logoutUser(); ResponseEntity<Void> logoutUserWithHttpInfo(); void updateUser(String username, User body); ResponseEntity<Void> updateUserWithHttpInfo(String username, User body); } |
@Test public void getUserByNameTest() { String username = null; User response = api.getUserByName(username); } | public User getUserByName(String username) throws RestClientException { return getUserByNameWithHttpInfo(username).getBody(); } | UserApi { public User getUserByName(String username) throws RestClientException { return getUserByNameWithHttpInfo(username).getBody(); } } | UserApi { public User getUserByName(String username) throws RestClientException { return getUserByNameWithHttpInfo(username).getBody(); } UserApi(); @Autowired UserApi(ApiClient apiClient); } | UserApi { public User getUserByName(String username) throws RestClientException { return getUserByNameWithHttpInfo(username).getBody(); } UserApi(); @Autowired UserApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void createUser(User body); ResponseEntity<Void> createUserWithHttpInfo(User body); void createUsersWithArrayInput(List<User> body); ResponseEntity<Void> createUsersWithArrayInputWithHttpInfo(List<User> body); void createUsersWithListInput(List<User> body); ResponseEntity<Void> createUsersWithListInputWithHttpInfo(List<User> body); void deleteUser(String username); ResponseEntity<Void> deleteUserWithHttpInfo(String username); User getUserByName(String username); ResponseEntity<User> getUserByNameWithHttpInfo(String username); String loginUser(String username, String password); ResponseEntity<String> loginUserWithHttpInfo(String username, String password); void logoutUser(); ResponseEntity<Void> logoutUserWithHttpInfo(); void updateUser(String username, User body); ResponseEntity<Void> updateUserWithHttpInfo(String username, User body); } | UserApi { public User getUserByName(String username) throws RestClientException { return getUserByNameWithHttpInfo(username).getBody(); } UserApi(); @Autowired UserApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void createUser(User body); ResponseEntity<Void> createUserWithHttpInfo(User body); void createUsersWithArrayInput(List<User> body); ResponseEntity<Void> createUsersWithArrayInputWithHttpInfo(List<User> body); void createUsersWithListInput(List<User> body); ResponseEntity<Void> createUsersWithListInputWithHttpInfo(List<User> body); void deleteUser(String username); ResponseEntity<Void> deleteUserWithHttpInfo(String username); User getUserByName(String username); ResponseEntity<User> getUserByNameWithHttpInfo(String username); String loginUser(String username, String password); ResponseEntity<String> loginUserWithHttpInfo(String username, String password); void logoutUser(); ResponseEntity<Void> logoutUserWithHttpInfo(); void updateUser(String username, User body); ResponseEntity<Void> updateUserWithHttpInfo(String username, User body); } |
@Test public void loginUserTest() { String username = null; String password = null; String response = api.loginUser(username, password); } | public String loginUser(String username, String password) throws RestClientException { return loginUserWithHttpInfo(username, password).getBody(); } | UserApi { public String loginUser(String username, String password) throws RestClientException { return loginUserWithHttpInfo(username, password).getBody(); } } | UserApi { public String loginUser(String username, String password) throws RestClientException { return loginUserWithHttpInfo(username, password).getBody(); } UserApi(); @Autowired UserApi(ApiClient apiClient); } | UserApi { public String loginUser(String username, String password) throws RestClientException { return loginUserWithHttpInfo(username, password).getBody(); } UserApi(); @Autowired UserApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void createUser(User body); ResponseEntity<Void> createUserWithHttpInfo(User body); void createUsersWithArrayInput(List<User> body); ResponseEntity<Void> createUsersWithArrayInputWithHttpInfo(List<User> body); void createUsersWithListInput(List<User> body); ResponseEntity<Void> createUsersWithListInputWithHttpInfo(List<User> body); void deleteUser(String username); ResponseEntity<Void> deleteUserWithHttpInfo(String username); User getUserByName(String username); ResponseEntity<User> getUserByNameWithHttpInfo(String username); String loginUser(String username, String password); ResponseEntity<String> loginUserWithHttpInfo(String username, String password); void logoutUser(); ResponseEntity<Void> logoutUserWithHttpInfo(); void updateUser(String username, User body); ResponseEntity<Void> updateUserWithHttpInfo(String username, User body); } | UserApi { public String loginUser(String username, String password) throws RestClientException { return loginUserWithHttpInfo(username, password).getBody(); } UserApi(); @Autowired UserApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void createUser(User body); ResponseEntity<Void> createUserWithHttpInfo(User body); void createUsersWithArrayInput(List<User> body); ResponseEntity<Void> createUsersWithArrayInputWithHttpInfo(List<User> body); void createUsersWithListInput(List<User> body); ResponseEntity<Void> createUsersWithListInputWithHttpInfo(List<User> body); void deleteUser(String username); ResponseEntity<Void> deleteUserWithHttpInfo(String username); User getUserByName(String username); ResponseEntity<User> getUserByNameWithHttpInfo(String username); String loginUser(String username, String password); ResponseEntity<String> loginUserWithHttpInfo(String username, String password); void logoutUser(); ResponseEntity<Void> logoutUserWithHttpInfo(); void updateUser(String username, User body); ResponseEntity<Void> updateUserWithHttpInfo(String username, User body); } |
@Test public void logoutUserTest() { api.logoutUser(); } | public void logoutUser() throws RestClientException { logoutUserWithHttpInfo(); } | UserApi { public void logoutUser() throws RestClientException { logoutUserWithHttpInfo(); } } | UserApi { public void logoutUser() throws RestClientException { logoutUserWithHttpInfo(); } UserApi(); @Autowired UserApi(ApiClient apiClient); } | UserApi { public void logoutUser() throws RestClientException { logoutUserWithHttpInfo(); } UserApi(); @Autowired UserApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void createUser(User body); ResponseEntity<Void> createUserWithHttpInfo(User body); void createUsersWithArrayInput(List<User> body); ResponseEntity<Void> createUsersWithArrayInputWithHttpInfo(List<User> body); void createUsersWithListInput(List<User> body); ResponseEntity<Void> createUsersWithListInputWithHttpInfo(List<User> body); void deleteUser(String username); ResponseEntity<Void> deleteUserWithHttpInfo(String username); User getUserByName(String username); ResponseEntity<User> getUserByNameWithHttpInfo(String username); String loginUser(String username, String password); ResponseEntity<String> loginUserWithHttpInfo(String username, String password); void logoutUser(); ResponseEntity<Void> logoutUserWithHttpInfo(); void updateUser(String username, User body); ResponseEntity<Void> updateUserWithHttpInfo(String username, User body); } | UserApi { public void logoutUser() throws RestClientException { logoutUserWithHttpInfo(); } UserApi(); @Autowired UserApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void createUser(User body); ResponseEntity<Void> createUserWithHttpInfo(User body); void createUsersWithArrayInput(List<User> body); ResponseEntity<Void> createUsersWithArrayInputWithHttpInfo(List<User> body); void createUsersWithListInput(List<User> body); ResponseEntity<Void> createUsersWithListInputWithHttpInfo(List<User> body); void deleteUser(String username); ResponseEntity<Void> deleteUserWithHttpInfo(String username); User getUserByName(String username); ResponseEntity<User> getUserByNameWithHttpInfo(String username); String loginUser(String username, String password); ResponseEntity<String> loginUserWithHttpInfo(String username, String password); void logoutUser(); ResponseEntity<Void> logoutUserWithHttpInfo(); void updateUser(String username, User body); ResponseEntity<Void> updateUserWithHttpInfo(String username, User body); } |
@Test public void updateUserTest() { String username = null; User body = null; api.updateUser(username, body); } | public void updateUser(String username, User body) throws RestClientException { updateUserWithHttpInfo(username, body); } | UserApi { public void updateUser(String username, User body) throws RestClientException { updateUserWithHttpInfo(username, body); } } | UserApi { public void updateUser(String username, User body) throws RestClientException { updateUserWithHttpInfo(username, body); } UserApi(); @Autowired UserApi(ApiClient apiClient); } | UserApi { public void updateUser(String username, User body) throws RestClientException { updateUserWithHttpInfo(username, body); } UserApi(); @Autowired UserApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void createUser(User body); ResponseEntity<Void> createUserWithHttpInfo(User body); void createUsersWithArrayInput(List<User> body); ResponseEntity<Void> createUsersWithArrayInputWithHttpInfo(List<User> body); void createUsersWithListInput(List<User> body); ResponseEntity<Void> createUsersWithListInputWithHttpInfo(List<User> body); void deleteUser(String username); ResponseEntity<Void> deleteUserWithHttpInfo(String username); User getUserByName(String username); ResponseEntity<User> getUserByNameWithHttpInfo(String username); String loginUser(String username, String password); ResponseEntity<String> loginUserWithHttpInfo(String username, String password); void logoutUser(); ResponseEntity<Void> logoutUserWithHttpInfo(); void updateUser(String username, User body); ResponseEntity<Void> updateUserWithHttpInfo(String username, User body); } | UserApi { public void updateUser(String username, User body) throws RestClientException { updateUserWithHttpInfo(username, body); } UserApi(); @Autowired UserApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void createUser(User body); ResponseEntity<Void> createUserWithHttpInfo(User body); void createUsersWithArrayInput(List<User> body); ResponseEntity<Void> createUsersWithArrayInputWithHttpInfo(List<User> body); void createUsersWithListInput(List<User> body); ResponseEntity<Void> createUsersWithListInputWithHttpInfo(List<User> body); void deleteUser(String username); ResponseEntity<Void> deleteUserWithHttpInfo(String username); User getUserByName(String username); ResponseEntity<User> getUserByNameWithHttpInfo(String username); String loginUser(String username, String password); ResponseEntity<String> loginUserWithHttpInfo(String username, String password); void logoutUser(); ResponseEntity<Void> logoutUserWithHttpInfo(); void updateUser(String username, User body); ResponseEntity<Void> updateUserWithHttpInfo(String username, User body); } |
@Test public void whenStreamCount_thenGetElementCount() { Long empCount = empList.stream() .filter(e -> e.getSalary() > 200000) .count(); assertEquals(empCount, new Long(1)); } | public Double getSalary() { return salary; } | Employee { public Double getSalary() { return salary; } } | Employee { public Double getSalary() { return salary; } Employee(Integer id, String name, Double salary); } | Employee { public Double getSalary() { return salary; } Employee(Integer id, String name, Double salary); Integer getId(); void setId(Integer id); String getName(); void setName(String name); Double getSalary(); void setSalary(Double salary); void salaryIncrement(Double percentage); String toString(); } | Employee { public Double getSalary() { return salary; } Employee(Integer id, String name, Double salary); Integer getId(); void setId(Integer id); String getName(); void setName(String name); Double getSalary(); void setSalary(Double salary); void salaryIncrement(Double percentage); String toString(); } |
@Test public void deleteOrderTest() { Long orderId = null; api.deleteOrder(orderId); } | public void deleteOrder(Long orderId) throws RestClientException { deleteOrderWithHttpInfo(orderId); } | StoreApi { public void deleteOrder(Long orderId) throws RestClientException { deleteOrderWithHttpInfo(orderId); } } | StoreApi { public void deleteOrder(Long orderId) throws RestClientException { deleteOrderWithHttpInfo(orderId); } StoreApi(); @Autowired StoreApi(ApiClient apiClient); } | StoreApi { public void deleteOrder(Long orderId) throws RestClientException { deleteOrderWithHttpInfo(orderId); } StoreApi(); @Autowired StoreApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void deleteOrder(Long orderId); ResponseEntity<Void> deleteOrderWithHttpInfo(Long orderId); Map<String, Integer> getInventory(); ResponseEntity<Map<String, Integer>> getInventoryWithHttpInfo(); Order getOrderById(Long orderId); ResponseEntity<Order> getOrderByIdWithHttpInfo(Long orderId); Order placeOrder(Order body); ResponseEntity<Order> placeOrderWithHttpInfo(Order body); } | StoreApi { public void deleteOrder(Long orderId) throws RestClientException { deleteOrderWithHttpInfo(orderId); } StoreApi(); @Autowired StoreApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void deleteOrder(Long orderId); ResponseEntity<Void> deleteOrderWithHttpInfo(Long orderId); Map<String, Integer> getInventory(); ResponseEntity<Map<String, Integer>> getInventoryWithHttpInfo(); Order getOrderById(Long orderId); ResponseEntity<Order> getOrderByIdWithHttpInfo(Long orderId); Order placeOrder(Order body); ResponseEntity<Order> placeOrderWithHttpInfo(Order body); } |
@Test public void getInventoryTest() { Map<String, Integer> response = api.getInventory(); } | public Map<String, Integer> getInventory() throws RestClientException { return getInventoryWithHttpInfo().getBody(); } | StoreApi { public Map<String, Integer> getInventory() throws RestClientException { return getInventoryWithHttpInfo().getBody(); } } | StoreApi { public Map<String, Integer> getInventory() throws RestClientException { return getInventoryWithHttpInfo().getBody(); } StoreApi(); @Autowired StoreApi(ApiClient apiClient); } | StoreApi { public Map<String, Integer> getInventory() throws RestClientException { return getInventoryWithHttpInfo().getBody(); } StoreApi(); @Autowired StoreApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void deleteOrder(Long orderId); ResponseEntity<Void> deleteOrderWithHttpInfo(Long orderId); Map<String, Integer> getInventory(); ResponseEntity<Map<String, Integer>> getInventoryWithHttpInfo(); Order getOrderById(Long orderId); ResponseEntity<Order> getOrderByIdWithHttpInfo(Long orderId); Order placeOrder(Order body); ResponseEntity<Order> placeOrderWithHttpInfo(Order body); } | StoreApi { public Map<String, Integer> getInventory() throws RestClientException { return getInventoryWithHttpInfo().getBody(); } StoreApi(); @Autowired StoreApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void deleteOrder(Long orderId); ResponseEntity<Void> deleteOrderWithHttpInfo(Long orderId); Map<String, Integer> getInventory(); ResponseEntity<Map<String, Integer>> getInventoryWithHttpInfo(); Order getOrderById(Long orderId); ResponseEntity<Order> getOrderByIdWithHttpInfo(Long orderId); Order placeOrder(Order body); ResponseEntity<Order> placeOrderWithHttpInfo(Order body); } |
@Test public void getOrderByIdTest() { Long orderId = null; Order response = api.getOrderById(orderId); } | public Order getOrderById(Long orderId) throws RestClientException { return getOrderByIdWithHttpInfo(orderId).getBody(); } | StoreApi { public Order getOrderById(Long orderId) throws RestClientException { return getOrderByIdWithHttpInfo(orderId).getBody(); } } | StoreApi { public Order getOrderById(Long orderId) throws RestClientException { return getOrderByIdWithHttpInfo(orderId).getBody(); } StoreApi(); @Autowired StoreApi(ApiClient apiClient); } | StoreApi { public Order getOrderById(Long orderId) throws RestClientException { return getOrderByIdWithHttpInfo(orderId).getBody(); } StoreApi(); @Autowired StoreApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void deleteOrder(Long orderId); ResponseEntity<Void> deleteOrderWithHttpInfo(Long orderId); Map<String, Integer> getInventory(); ResponseEntity<Map<String, Integer>> getInventoryWithHttpInfo(); Order getOrderById(Long orderId); ResponseEntity<Order> getOrderByIdWithHttpInfo(Long orderId); Order placeOrder(Order body); ResponseEntity<Order> placeOrderWithHttpInfo(Order body); } | StoreApi { public Order getOrderById(Long orderId) throws RestClientException { return getOrderByIdWithHttpInfo(orderId).getBody(); } StoreApi(); @Autowired StoreApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void deleteOrder(Long orderId); ResponseEntity<Void> deleteOrderWithHttpInfo(Long orderId); Map<String, Integer> getInventory(); ResponseEntity<Map<String, Integer>> getInventoryWithHttpInfo(); Order getOrderById(Long orderId); ResponseEntity<Order> getOrderByIdWithHttpInfo(Long orderId); Order placeOrder(Order body); ResponseEntity<Order> placeOrderWithHttpInfo(Order body); } |
@Test public void placeOrderTest() { Order body = null; Order response = api.placeOrder(body); } | public Order placeOrder(Order body) throws RestClientException { return placeOrderWithHttpInfo(body).getBody(); } | StoreApi { public Order placeOrder(Order body) throws RestClientException { return placeOrderWithHttpInfo(body).getBody(); } } | StoreApi { public Order placeOrder(Order body) throws RestClientException { return placeOrderWithHttpInfo(body).getBody(); } StoreApi(); @Autowired StoreApi(ApiClient apiClient); } | StoreApi { public Order placeOrder(Order body) throws RestClientException { return placeOrderWithHttpInfo(body).getBody(); } StoreApi(); @Autowired StoreApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void deleteOrder(Long orderId); ResponseEntity<Void> deleteOrderWithHttpInfo(Long orderId); Map<String, Integer> getInventory(); ResponseEntity<Map<String, Integer>> getInventoryWithHttpInfo(); Order getOrderById(Long orderId); ResponseEntity<Order> getOrderByIdWithHttpInfo(Long orderId); Order placeOrder(Order body); ResponseEntity<Order> placeOrderWithHttpInfo(Order body); } | StoreApi { public Order placeOrder(Order body) throws RestClientException { return placeOrderWithHttpInfo(body).getBody(); } StoreApi(); @Autowired StoreApi(ApiClient apiClient); ApiClient getApiClient(); void setApiClient(ApiClient apiClient); void deleteOrder(Long orderId); ResponseEntity<Void> deleteOrderWithHttpInfo(Long orderId); Map<String, Integer> getInventory(); ResponseEntity<Map<String, Integer>> getInventoryWithHttpInfo(); Order getOrderById(Long orderId); ResponseEntity<Order> getOrderByIdWithHttpInfo(Long orderId); Order placeOrder(Order body); ResponseEntity<Order> placeOrderWithHttpInfo(Order body); } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.