id stringlengths 7 14 | test_class dict | test_case dict | focal_class dict | focal_method dict | repository dict |
|---|---|---|---|---|---|
80228150_171 | {
"fields": [
{
"declarator": "factory",
"modifier": "@InjectMocks",
"original_string": "@InjectMocks\n UpdatePortGroupHookTask factory;",
"type": "UpdatePortGroupHookTask",
"var_name": "factory"
}
],
"file": "osc-server/src/test/java/org/osc/core/broker/service/tasks/conf... | {
"body": "@Test\n public void testExecute_WhenUpdateInspectionHookSucceeds_ExecutionFinishes() throws Exception {\n // Arrange.\n SecurityGroup sg = newSecurityGroup();\n SecurityGroupInterface sgi = registerNewSGI(sg, 2L);\n DistributedApplianceInstance dai = registerNewDAI();\n\n ... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(UpdatePortGroupHookTask.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(UpdatePortGroupHookTask.class);",
"type": "Logger",
"var_name": "LOG"
},... | {
"body": "public UpdatePortGroupHookTask create(SecurityGroupInterface sgi, DistributedApplianceInstance dai){\n UpdatePortGroupHookTask task = new UpdatePortGroupHookTask(sgi, dai);\n task.apiFactoryService = this.apiFactoryService;\n task.dbConnectionManager = this.dbConnectionManager;\n ... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_17 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator":... | {
"body": "@Test\n public void testIsServiceReady_WhenComponentStatusIsNull_ServiceNotReady() throws Exception {\n // Arrange.\n mockComponentStatus(null);\n\n // Act.\n boolean isServiceReady = this.api.isServiceReady();\n\n // Assert.\n assertFalse(isServiceReady);\n ... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(KubernetesStatusApi.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(KubernetesStatusApi.class);",
"type": "Logger",
"var_name": "LOG"
},
{
... | {
"body": "public boolean isServiceReady() throws VmidcException {\n boolean result = false;\n try {\n ComponentStatus status = getKubernetesClient().componentstatuses().withName(K8S_CONTROLLER_COMPONENT_NAME).get();\n if (status == null) {\n LOG.warn(String.format(\... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_126 | {
"fields": [
{
"declarator": "em",
"modifier": "@Mock\n protected",
"original_string": "@Mock\n protected EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "tx",
"modifier": "@Mock\n protected",
"original_string": "@M... | {
"body": "@Test\n public void testExecute_WhenSDNThrowsException_ThrowsUnhandledException() throws Exception {\n // Arrange.\n DistributedApplianceInstance dai = createAndRegisterDAI();\n RegisterK8sDAIInspectionPortTask task = this.factory.create(dai);\n\n mockRegisterInspectionPortNe... | {
"fields": [
{
"declarator": "dai",
"modifier": "private",
"original_string": "private DistributedApplianceInstance dai;",
"type": "DistributedApplianceInstance",
"var_name": "dai"
},
{
"declarator": "apiFactoryService",
"modifier": "@Reference\n private",
... | {
"body": "public RegisterK8sDAIInspectionPortTask create(DistributedApplianceInstance dai) {\n RegisterK8sDAIInspectionPortTask task = new RegisterK8sDAIInspectionPortTask();\n task.dbConnectionManager = this.dbConnectionManager;\n task.txBroadcastUtil = this.txBroadcastUtil;\n task.apiFa... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_40 | {
"fields": [
{
"declarator": "FILE_TEXT = \"Some file input.\"",
"modifier": "private final static",
"original_string": "private final static String FILE_TEXT = \"Some file input.\";",
"type": "String",
"var_name": "FILE_TEXT"
},
{
"declarator": "DIR_PATH = System.getP... | {
"body": "@Test\n public void writeBytesToFile_fileNotExists_expectedFailOnMoveFileToBackup() throws Exception {\n //Arrange.\n Path file = Paths.get(DIR_PATH + File.separator + FILE_NAME);\n Path backup = Paths.get(INVALID_DIR_PATH + File.separator + FILE_NAME + \".org\");\n Writer lo... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(PKIUtil.class)",
"modifier": "private static final",
"original_string": "private static final Logger log = LoggerFactory.getLogger(PKIUtil.class);",
"type": "Logger",
"var_name": "log"
},
{
"declarator": "keyA... | {
"body": "public static void writeBytesToFile(byte[] bytes, String parentFolderName, String fileName) {\n\n StringBuilder sb = new StringBuilder(parentFolderName)\n .append(File.separator)\n .append(fileName);\n\n Path file = Paths.get(sb.toString());\n Path backup ... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_83 | {
"fields": [
{
"declarator": "oldProcessId = \"10000\"",
"modifier": "private final",
"original_string": "private final String oldProcessId = \"10000\";",
"type": "String",
"var_name": "oldProcessId"
},
{
"declarator": "linuxProcessExec = \"ps \"",
"modifier": "p... | {
"body": "@Test\n public void testGetPidByProcessName_WithImproperData_ThrowsInputStreamException() throws IOException, InterruptedException {\n // Arrange.\n PowerMockito.when(this.processMock.getInputStream()).thenReturn(null);\n PowerMockito.when(this.runtimeMock.exec(this.linuxProcessExec... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(ServerUtil.class)",
"modifier": "private static final",
"original_string": "private static final Logger log = LoggerFactory.getLogger(ServerUtil.class);",
"type": "Logger",
"var_name": "log"
},
{
"declarator":... | {
"body": "public static String getPidByProcessName(String processName) {\n try {\n String psArg = \"\";\n if (isWindows()) {\n psArg += \"-W\";\n }\n\n Process p = java.lang.Runtime.getRuntime().exec(\"ps \" + psArg);\n int exitVal = p.wait... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_223 | {
"fields": [
{
"declarator": "em",
"modifier": "private",
"original_string": "private EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "txControl",
"modifier": "@Mock(answer=Answers.CALLS_REAL_METHODS)",
"original_string": "@... | {
"body": "@Test\n public void testValidateforCreate_UsingValidNewModel_Suceeds() throws Exception {\n // Arrange.\n ApplianceDto dto = new ApplianceDto(UUID.randomUUID().toString(), UUID.randomUUID().toString(), UUID.randomUUID().toString());\n\n // Act.\n this.validator.validateForCre... | {
"fields": [
{
"declarator": "em",
"modifier": "private",
"original_string": "private EntityManager em;",
"type": "EntityManager",
"var_name": "em"
}
],
"file": "osc-server/src/main/java/org/osc/core/broker/service/validator/ApplianceDtoValidator.java",
"identifier": "Appl... | {
"body": "@Override\n public void validateForCreate(ApplianceDto dto) throws Exception {\n checkForNullFields(dto);\n\n checkFieldLength(dto);\n\n Appliance existingAppliance = ApplianceEntityMgr.findByModel(this.em, dto.getModel());\n\n if (existingAppliance != null) {\n th... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_95 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator":... | {
"body": "@Test\n public void testConnection_WithKubernetes_WithIgnoreControllerException_WhenProviderNotReady_ThrowsErrorTypeException() throws Exception {\n // Arrange.\n this.exception.expect(ErrorTypeException.class);\n this.exception.expectMessage(\"Kubernetes reported service NOT ready.... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(VirtualizationConnectorUtil.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(VirtualizationConnectorUtil.class);",
"type": "Logger",
"var_name": "LOG... | {
"body": "public <T extends VirtualizationConnectorDto> void checkConnection(DryRunRequest<T> request, VirtualizationConnector vc) throws Exception {\n if (!request.isSkipAllDryRun()) {\n ErrorTypeException errorTypeException = null;\n final ArrayList<CertificateResolverModel> certifica... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_235 | {
"fields": [
{
"declarator": "A = new EmptyTask(\"A\")",
"modifier": "private",
"original_string": "private EmptyTask A = new EmptyTask(\"A\");",
"type": "EmptyTask",
"var_name": "A"
},
{
"declarator": "B = new EmptyTask(\"B\")",
"modifier": "private",
"ori... | {
"body": "@Test\n @Ignore // this test is unstable\n public void testPutJob() {\n\n final TaskGraph tg = new TaskGraph();\n tg.addTask(this.A);\n tg.addTask(this.B);\n tg.addTask(this.C, this.A);\n tg.addTask(this.D, this.A);\n\n final TaskGraph tg2 = new TaskGraph();\... | {
"fields": [
{
"declarator": "jobQueue = new LinkedBlockingQueue<>()",
"modifier": "private static final",
"original_string": "private static final BlockingQueue<JobRequest> jobQueue = new LinkedBlockingQueue<>();",
"type": "BlockingQueue<JobRequest>",
"var_name": "jobQueue"
},
... | {
"body": "public synchronized void putJob(JobRequest job) {\n try {\n log.info(String.format(\"Job %s put into queue\", job.getName()));\n jobQueue.put(job);\n } catch (InterruptedException e) {\n log.warn(\"Putting job in queue was interrupted.\", e);\n }\n }... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_26 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator":... | {
"body": "@Test\n public void testGetPodsbyId_WithNullName_ThrowsIllegalArgumentException() throws Exception {\n // Arrange.\n this.exception.expect(IllegalArgumentException.class);\n\n // Act.\n this.service.getPodById(\"1234\", null, \"sample_namespace\");\n }",
"class_method_si... | {
"fields": [],
"file": "osc-server/src/main/java/org/osc/core/broker/rest/client/k8s/KubernetesPodApi.java",
"identifier": "KubernetesPodApi",
"interfaces": "",
"methods": [
{
"class_method_signature": "KubernetesPodApi.KubernetesPodApi(KubernetesClient client)",
"constructor": true,
"f... | {
"body": "public KubernetesPod getPodById(String uid, String namespace, String name) throws VmidcException {\n if (uid == null) {\n throw new IllegalArgumentException(\"Uid should not be null\");\n }\n\n if (name == null) {\n throw new IllegalArgumentException(\"Name should... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_140 | {
"fields": [
{
"declarator": "em",
"modifier": "public",
"original_string": "public EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": ... | {
"body": "@Test\n public void testExecute_WithAValidNewPod_PodAndPortArePersisted() throws Exception {\n // Arrange.\n CreateK8sLabelPodTask task = this.factoryTask.create(VALID_K8S_POD, VALID_POD_SGM_LABEL);\n NetworkElement podPort = createNetworkElement();\n registerNetworkElement(V... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(CreateK8sLabelPodTask.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(CreateK8sLabelPodTask.class);",
"type": "Logger",
"var_name": "LOG"
},
... | {
"body": "public CreateK8sLabelPodTask create(KubernetesPod k8sPod, Label label) {\n CreateK8sLabelPodTask task = new CreateK8sLabelPodTask();\n task.k8sPod = k8sPod;\n task.label = label;\n task.apiFactoryService = this.apiFactoryService;\n task.dbConnectionManager = this.dbConnec... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_71 | {
"fields": [],
"file": "osc-server/src/test/java/org/osc/core/broker/util/NetworkUtilTest.java",
"identifier": "NetworkUtilTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGetPrefixLength() {\n List<Integer> prefixLength = Arrays.asList(32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16,\n 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);\n\n for (int i = 0; i < NetworkUtil.validNetMasks.size(); i++... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(NetworkUtil.class)",
"modifier": "private static final",
"original_string": "private static final Logger log = LoggerFactory.getLogger(NetworkUtil.class);",
"type": "Logger",
"var_name": "log"
},
{
"declarator... | {
"body": "public static int getPrefixLength(String netmask) {\n if (!validNetMasks.contains(netmask)) {\n throw new IllegalArgumentException(netmask + \" is not a valid netmask.\");\n }\n String[] octets = netmask.split(\"\\\\.\");\n int octet1 = Integer.parseInt(octets[0]);\n ... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_117 | {
"fields": [
{
"declarator": "em",
"modifier": "@Mock\n protected",
"original_string": "@Mock\n protected EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "tx",
"modifier": "@Mock\n protected",
"original_string": "@M... | {
"body": "@Test\n public void testExecute_WhenSDNThrowsException_ThrowsUnhandledException() throws Exception {\n // Arrange.\n DistributedApplianceInstance dai = createAndRegisterDAI();\n DeleteK8sDAIInspectionPortTask task = this.factory.create(dai);\n\n doThrow(new IllegalStateExcept... | {
"fields": [
{
"declarator": "dai",
"modifier": "private",
"original_string": "private DistributedApplianceInstance dai;",
"type": "DistributedApplianceInstance",
"var_name": "dai"
},
{
"declarator": "apiFactoryService",
"modifier": "@Reference\n private",
... | {
"body": "public DeleteK8sDAIInspectionPortTask create(DistributedApplianceInstance dai) {\n DeleteK8sDAIInspectionPortTask task = new DeleteK8sDAIInspectionPortTask();\n task.dbConnectionManager = this.dbConnectionManager;\n task.txBroadcastUtil = this.txBroadcastUtil;\n task.apiFactoryS... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_67 | {
"fields": [
{
"declarator": "USER = \"admin\"",
"modifier": "private static final",
"original_string": "private static final String USER = \"admin\";",
"type": "String",
"var_name": "USER"
},
{
"declarator": "PASSWORD = \"admin123\"",
"modifier": "private static... | {
"body": "@Test(expected = WebApplicationException.class)\n public void testAuthenticateLocalInvalidAddress() throws URISyntaxException {\n Mockito.when(this.uriInfo.getRequestUri()).thenReturn(new URI(\"http://127.0.0.2\"));\n Mockito.when(this.mockRequest.getUriInfo()).thenReturn(this.uriInfo);\n ... | {
"fields": [
{
"declarator": "encrypter",
"modifier": "@Reference",
"original_string": "@Reference\n EncryptionApi encrypter;",
"type": "EncryptionApi",
"var_name": "encrypter"
},
{
"declarator": "logging",
"modifier": "@Reference",
"original_string": "@... | {
"body": "public void authenticateLocalRequest(ContainerRequestContext request) {\n WebApplicationException wae = new WebApplicationException(\n Response.status(Response.Status.UNAUTHORIZED).entity(\"not authorized\").build());\n if(request.getUriInfo()!=null && request.getUriInfo().getR... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_101 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator":... | {
"body": "@Test\n public void testConnection_WithOpenStack_WithIgnoreControllerException_WithIgnoreProviderException_WhenRabbitClientConnectionFail_ThrowsErrorTypeException() throws Throwable {\n // Arrange.\n this.exception.expect(ErrorTypeException.class);\n\n DryRunRequest<VirtualizationCo... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(VirtualizationConnectorUtil.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(VirtualizationConnectorUtil.class);",
"type": "Logger",
"var_name": "LOG... | {
"body": "public <T extends VirtualizationConnectorDto> void checkConnection(DryRunRequest<T> request, VirtualizationConnector vc) throws Exception {\n if (!request.isSkipAllDryRun()) {\n ErrorTypeException errorTypeException = null;\n final ArrayList<CertificateResolverModel> certifica... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_88 | {
"fields": [
{
"declarator": "oldProcessId = \"10000\"",
"modifier": "private final",
"original_string": "private final String oldProcessId = \"10000\";",
"type": "String",
"var_name": "oldProcessId"
},
{
"declarator": "linuxProcessExec = \"ps \"",
"modifier": "p... | {
"body": "@Test\n public void testReadPIDFromFile_WithoutFile_ReturnsNull() throws IOException, CorruptedPidException {\n // Arrange.\n this.regularFile = new File(this.homeDirectory, this.PID_FILE);\n if (this.regularFile.exists()) {\n boolean isDeleted = this.regularFile.delete()... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(ServerUtil.class)",
"modifier": "private static final",
"original_string": "private static final Logger log = LoggerFactory.getLogger(ServerUtil.class);",
"type": "Logger",
"var_name": "log"
},
{
"declarator":... | {
"body": "static Integer readPIDFromFile(String filename) throws CorruptedPidException {\n if (!new File(filename).exists()) {\n return null;\n }\n\n String PID = null;\n try (BufferedReader in = new BufferedReader(new FileReader(filename))){\n PID = in.readLine();\n... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_228 | {
"fields": [
{
"declarator": "em",
"modifier": "@Mock\n private",
"original_string": "@Mock\n private EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "txBroadcastUtil",
"modifier": "@Mock\n private",
"original_strin... | {
"body": "@Test\n public void testValidateForUpdate_WithUserMissingId_ThrowsInvalidEntryException() throws Exception {\n // Arrange.\n this.exception.expect(VmidcBrokerInvalidEntryException.class);\n this.exception.expectMessage(\"Id \" + EMPTY_VALUE_ERROR_MESSAGE);\n\n // Act.\n ... | {
"fields": [
{
"declarator": "em",
"modifier": "",
"original_string": "EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "txBroadcastUtil",
"modifier": "private",
"original_string": "private TransactionalBroadcastUtil txBroadc... | {
"body": "@Override\n public User validateForUpdate(UserDto dto) throws Exception {\n BaseDtoValidator.checkForNullId(dto);\n\n validate(dto);\n\n OSCEntityManager<User> emgr = new OSCEntityManager<User>(User.class, this.em, this.txBroadcastUtil);\n\n User user = emgr.findByPrimaryKey(... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_30 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator":... | {
"body": "@Test\n public void testGetPodsbyId_WhenK8sReturnsNull_ReturnsNull() throws Exception {\n // Arrange.\n String name = UUID.randomUUID().toString();\n String namespace = UUID.randomUUID().toString();\n mockPodsByName(namespace, name, null);\n\n // Act.\n Kubernet... | {
"fields": [],
"file": "osc-server/src/main/java/org/osc/core/broker/rest/client/k8s/KubernetesPodApi.java",
"identifier": "KubernetesPodApi",
"interfaces": "",
"methods": [
{
"class_method_signature": "KubernetesPodApi.KubernetesPodApi(KubernetesClient client)",
"constructor": true,
"f... | {
"body": "public KubernetesPod getPodById(String uid, String namespace, String name) throws VmidcException {\n if (uid == null) {\n throw new IllegalArgumentException(\"Uid should not be null\");\n }\n\n if (name == null) {\n throw new IllegalArgumentException(\"Name should... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_156 | {
"fields": [
{
"declarator": "factory",
"modifier": "@InjectMocks",
"original_string": "@InjectMocks\n DeleteInspectionPortTask factory;",
"type": "DeleteInspectionPortTask",
"var_name": "factory"
},
{
"declarator": "em",
"modifier": "@Mock\n protected",
... | {
"body": "@Test\n public void testExecute_WhenDomainFound_DeletionIsSuccesfull() throws Exception {\n // Arrange.\n DistributedApplianceInstance dai = registerNewDAI(1L);\n String domainId = UUID.randomUUID().toString();\n\n registerDomain(domainId, dai);\n\n SdnRedirectionApi r... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(DeleteInspectionPortTask.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(DeleteInspectionPortTask.class);",
"type": "Logger",
"var_name": "LOG"
... | {
"body": "public DeleteInspectionPortTask create(String region, DistributedApplianceInstance dai) {\n DeleteInspectionPortTask task = new DeleteInspectionPortTask();\n // TODO emanoel: This does not seem to be used anywhere, remove it on master.\n task.region = region;\n task.dai = dai;\n... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_0 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator":... | {
"body": "@Test\n public void testGetDeploymentbyId_WhenK8ClientThrowsKubernetesClientException_ThrowsVmidcException() throws Exception {\n // Arrange.\n this.exception.expect(VmidcException.class);\n when(this.extensionsApiMock.deployments()).thenThrow(new KubernetesClientException(\"\"));\n... | {
"fields": [
{
"declarator": "OSC_DEPLOYMENT_LABEL_NAME = \"osc-deployment\"",
"modifier": "public final static",
"original_string": "public final static String OSC_DEPLOYMENT_LABEL_NAME = \"osc-deployment\";",
"type": "String",
"var_name": "OSC_DEPLOYMENT_LABEL_NAME"
},
{
... | {
"body": "public KubernetesDeployment getDeploymentById(String uid, String namespace, String name) throws VmidcException {\n if (uid == null) {\n throw new IllegalArgumentException(\"Uid should not be null\");\n }\n\n if (name == null) {\n throw new IllegalArgumentException... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_204 | {
"fields": [
{
"declarator": "INSPECTION_HOOK_ID = \"inspection-hook-id\"",
"modifier": "private static final",
"original_string": "private static final String INSPECTION_HOOK_ID = \"inspection-hook-id\";",
"type": "String",
"var_name": "INSPECTION_HOOK_ID"
},
{
"decla... | {
"body": "@Test\n public void testExecute_WithoutInspectionHook_ExpectSuccess() throws Exception {\n // Arrange\n when(this.port.getInspectionHookId()).thenReturn(null);\n\n SfcFlowClassifierDeleteTask deleteTask = this.task.create(this.sg, this.port);\n\n // Act.\n deleteTask.e... | {
"fields": [
{
"declarator": "apiFactory",
"modifier": "@Reference\n private",
"original_string": "@Reference\n private ApiFactoryService apiFactory;",
"type": "ApiFactoryService",
"var_name": "apiFactory"
},
{
"declarator": "securityGroup",
"modifier": "pr... | {
"body": "public SfcFlowClassifierDeleteTask create(SecurityGroup securityGroup, VMPort port) {\n SfcFlowClassifierDeleteTask task = new SfcFlowClassifierDeleteTask();\n\n task.securityGroup = securityGroup;\n task.port = port;\n task.vmName = port.getVm() != null ? port.getVm().getName()... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_195 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n\tpublic",
"original_string": "@Rule\n\tpublic ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "em... | {
"body": "@Test\n\tpublic void testExecute_WithSecurityGroupSFCBoundAndExistingSGElementIdNull_ExpectCreate() throws Exception {\n\t\t// Arrange.\n\t\tCreateServiceFunctionChainTask task = this.task\n\t\t\t\t.create(NEW_SG_SAME_SFC_BINDED_EXISTING_SG_ELEMENT_ID_NULL_CREATE_ELEMENT, this.portPairGroup);\n\t\tregister... | {
"fields": [
{
"declarator": "apiFactory",
"modifier": "@Reference\n\tprivate",
"original_string": "@Reference\n\tprivate ApiFactoryService apiFactory;",
"type": "ApiFactoryService",
"var_name": "apiFactory"
},
{
"declarator": "sfc",
"modifier": "private",
... | {
"body": "public CreateServiceFunctionChainTask create(SecurityGroup securityGroup, List<NetworkElement> portPairGroups) {\n\t\tCreateServiceFunctionChainTask task = new CreateServiceFunctionChainTask();\n\n\t\ttask.sfc = securityGroup.getServiceFunctionChain();\n\t\ttask.securityGroup = securityGroup;\n\t\ttask.por... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_183 | {
"fields": [
{
"declarator": "factory",
"modifier": "@InjectMocks",
"original_string": "@InjectMocks\n DeallocateDAIOfSGIMembersTask factory;",
"type": "DeallocateDAIOfSGIMembersTask",
"var_name": "factory"
}
],
"file": "osc-server/src/test/java/org/osc/core/broker/servic... | {
"body": "@Test\n public void testExecute_WhenSGIHasNetworkSGMember_DeallocatesDAIsOfVMPort() throws Exception {\n // Arrange.\n SecurityGroup sg = new SecurityGroup(null, null, null);\n sg.addSecurityGroupMember(newSGMWithPort(Network.class, 1L));\n\n SecurityGroupInterface sgi = regi... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(AllocateDAIWithSGIMembersTask.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(AllocateDAIWithSGIMembersTask.class);",
"type": "Logger",
"var_name": ... | {
"body": "@Override\n public DeallocateDAIOfSGIMembersTask create(SecurityGroupInterface sgi, DistributedApplianceInstance dai) {\n DeallocateDAIOfSGIMembersTask task = new DeallocateDAIOfSGIMembersTask(sgi, dai);\n task.dbConnectionManager = this.dbConnectionManager;\n task.txBroadcastUtil =... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_245 | {
"fields": [],
"file": "osc-installer/src/test/java/org/osc/core/server/installer/impl/RequirementParserTest.java",
"identifier": "RequirementParserTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testParseRequireBundle() {\n\t\tList<Requirement> actual = RequirementParser.parseRequireBundle(\"foo;bundle-version=1.0.0, bar;bundle-version=\\\"[1.0,1.1)\\\", baz;bundle-version=\\\"[2.0,3.0)\\\", fnarg\");\n\t\t\n\t\tassertEquals(4, actual.size());\n\t\tassertEquals(\"(&(osgi.wirin... | {
"fields": [],
"file": "osc-installer/src/main/java/org/osc/core/server/installer/impl/RequirementParser.java",
"identifier": "RequirementParser",
"interfaces": "",
"methods": [
{
"class_method_signature": "RequirementParser.parseRequireBundle(String header)",
"constructor": false,
"ful... | {
"body": "static List<Requirement> parseRequireBundle(String header) throws IllegalArgumentException {\n\t\tif (header == null) {\n return Collections.emptyList();\n }\n\n\t\tClause[] clauses = Parser.parseHeader(header);\n\t\tList<Requirement> requirements = new ArrayList<>(clauses.length);\n\t\tf... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_212 | {
"fields": [
{
"declarator": "mockEM",
"modifier": "private",
"original_string": "private EntityManager mockEM;",
"type": "EntityManager",
"var_name": "mockEM"
},
{
"declarator": "mockedTransaction",
"modifier": "private",
"original_string": "private Entity... | {
"body": "@Test(expected = Exception.class)\n public void testExecuteInvalidRequest() throws Exception {\n ServiceDispatcher<?, ?> mockServiceDispatcher = new ServiceDispatcher<Request, Response>() {\n\n {\n this.userContext = Mockito.mock(UserContextApi.class);\n }\n\n... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(ServiceDispatcher.class)",
"modifier": "private static final",
"original_string": "private static final Logger log = LoggerFactory.getLogger(ServiceDispatcher.class);",
"type": "Logger",
"var_name": "log"
},
{
... | {
"body": "@Override\n public O dispatch(I request) throws Exception {\n log.info(\"Service dispatch \" + this.getClass().getSimpleName() + \". User: \" + this.userContext.getCurrentUser()\n + \", Request: \" + request);\n\n if (Server.isInMaintenance()) {\n log.warn(\"Incoming requ... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_232 | {
"fields": [],
"file": "osc-server/src/test/java/org/osc/core/broker/service/validator/VirtualizationConnectorDtoValidatorTest.java",
"identifier": "VirtualizationConnectorDtoValidatorTest",
"interfaces": "",
"superclass": "extends VirtualizationConnectorDtoValidatorBaseTest"
} | {
"body": "@Test\n public void testValidateForCreate_WhenControllerIpExists_ThrowsValidationException() throws Exception {\n // Arrange.\n this.exception.expect(VmidcBrokerValidationException.class);\n VirtualizationConnectorDto dto = VirtualizationConnectorDtoValidatorTestData.OPENSTACK_CONTR... | {
"fields": [
{
"declarator": "em",
"modifier": "private",
"original_string": "private EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "txBroadcastUtil",
"modifier": "private",
"original_string": "private TransactionalBroadca... | {
"body": "@Override\n public void validateForCreate(VirtualizationConnectorDto dto) throws Exception {\n // Initializing Entity Manager\n OSCEntityManager<VirtualizationConnector> emgr = new OSCEntityManager<>(\n VirtualizationConnector.class, this.em, this.txBroadcastUtil);\n\n ... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_92 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator":... | {
"body": "@Test\n public void testConnection_WithOpenStack_WithIgnoreProviderException_WithIgnoreRabbitMqException_WhenSdnControllerStatusSuccess_ReturnsSuccessful() throws Exception {\n // Arrange.\n DryRunRequest<VirtualizationConnectorRequest> request = VirtualizationConnectorUtilTestData.generat... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(VirtualizationConnectorUtil.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(VirtualizationConnectorUtil.class);",
"type": "Logger",
"var_name": "LOG... | {
"body": "public <T extends VirtualizationConnectorDto> void checkConnection(DryRunRequest<T> request, VirtualizationConnector vc) throws Exception {\n if (!request.isSkipAllDryRun()) {\n ErrorTypeException errorTypeException = null;\n final ArrayList<CertificateResolverModel> certifica... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_224 | {
"fields": [
{
"declarator": "em",
"modifier": "@Mock\n private",
"original_string": "@Mock\n private EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "txBroadcastUtil",
"modifier": "@Mock\n private",
"original_strin... | {
"body": "@Test\n @Parameters(method = \"getInvalidFieldsTestData\")\n public void testValidate_UsingInvalidField_ThrowsInvalidEntryException(UserDto dto, String expectedErrorMessage) throws Exception {\n // Arrange.\n this.exception.expect(VmidcBrokerInvalidEntryException.class);\n this.e... | {
"fields": [
{
"declarator": "em",
"modifier": "",
"original_string": "EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "txBroadcastUtil",
"modifier": "private",
"original_string": "private TransactionalBroadcastUtil txBroadc... | {
"body": "void validate(UserDto dto) throws Exception {\n UserDtoValidator.checkForNullFields(dto);\n UserDtoValidator.checkFieldLength(dto);\n\n //validating email address formatting\n if (!StringUtils.isBlank(dto.getEmail())) {\n ValidateUtil.checkForValidEmailAddress(dto.get... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_84 | {
"fields": [
{
"declarator": "oldProcessId = \"10000\"",
"modifier": "private final",
"original_string": "private final String oldProcessId = \"10000\";",
"type": "String",
"var_name": "oldProcessId"
},
{
"declarator": "linuxProcessExec = \"ps \"",
"modifier": "p... | {
"body": "@Test\n public void testGetPidByProcessName_WithWindowsMachineFlag_ReturnsProperProcessId() throws IOException, InterruptedException {\n // Arrange.\n InputStream stubInputStream = IOUtils.toInputStream(\n \" PID TTY STAT TIME COMMAND\\n 9990 ? Ss 0:07 /test/java\\n \" + thi... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(ServerUtil.class)",
"modifier": "private static final",
"original_string": "private static final Logger log = LoggerFactory.getLogger(ServerUtil.class);",
"type": "Logger",
"var_name": "log"
},
{
"declarator":... | {
"body": "public static String getPidByProcessName(String processName) {\n try {\n String psArg = \"\";\n if (isWindows()) {\n psArg += \"-W\";\n }\n\n Process p = java.lang.Runtime.getRuntime().exec(\"ps \" + psArg);\n int exitVal = p.wait... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_208 | {
"fields": [
{
"declarator": "txBroadcastUtil",
"modifier": "@Mock\n private",
"original_string": "@Mock\n private TransactionalBroadcastUtil txBroadcastUtil;",
"type": "TransactionalBroadcastUtil",
"var_name": "txBroadcastUtil"
},
{
"declarator": "em",
"mo... | {
"body": "@Test\n public void testRun_WithValidInput_UpdatesEntityProperly() throws Exception {\n // Act.\n this.target.run(this.em,new CompleteJobTransactionInput(this.existingEntityId, this.existingJobId));\n\n // Assert.\n verify(this.testEntity, times(1)).setLastJob(this.testLastJo... | {
"fields": [
{
"declarator": "entityType",
"modifier": "private",
"original_string": "private Class<T> entityType;",
"type": "Class<T>",
"var_name": "entityType"
},
{
"declarator": "txBroadcastUtil",
"modifier": "private",
"original_string": "private Transa... | {
"body": "public Void run(EntityManager em, CompleteJobTransactionInput param) throws Exception {\n T entity = em.find(this.entityType, param.getEntityId());\n\n if (entity == null) {\n throw new IllegalArgumentException(String.format(\"Entity with Id '%d' does not exist.\", param.getEntityI... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_121 | {
"fields": [
{
"declarator": "em",
"modifier": "@Mock\n protected",
"original_string": "@Mock\n protected EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "tx",
"modifier": "@Mock\n protected",
"original_string": "@M... | {
"body": "@Test\n public void testExecute_WhenSDNReturnsNetworkElement_NoOrphanDAI_DAICreatedWithoutInspectionElementId() throws Exception {\n // Arrange.\n KubernetesPod k8sPod = createKubernetesPod();\n DefaultNetworkPort podPort = createNetworkElement();\n podPort.setParentId(UUID.r... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(CreateOrUpdateK8sDAITask.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(CreateOrUpdateK8sDAITask.class);",
"type": "Logger",
"var_name": "LOG"
... | {
"body": "public CreateOrUpdateK8sDAITask create(DeploymentSpec ds, KubernetesPod k8sPod) {\n return create(ds, k8sPod, null);\n }",
"class_method_signature": "CreateOrUpdateK8sDAITask.create(DeploymentSpec ds, KubernetesPod k8sPod)",
"constructor": false,
"full_signature": "public CreateOrUpdateK8sD... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_47 | {
"fields": [
{
"declarator": "unEncryptedMessage = \"helloworld\"",
"modifier": "private",
"original_string": "private String unEncryptedMessage = \"helloworld\";",
"type": "String",
"var_name": "unEncryptedMessage"
},
{
"declarator": "aesCtrEncryptedMessage = \"af5b59... | {
"body": "@Test\n public void testEncryptPbkdf2_WithEmptyMessage_ExpectsEmptyMessage() throws EncryptionException {\n String encryption = EncryptionUtil.encryptPbkdf2(\"\");\n assertEquals(\"\", encryption);\n }",
"class_method_signature": "EncryptionUtilTest.testEncryptPbkdf2_WithEmptyMessage_... | {
"fields": [
{
"declarator": "SECURITY_PROPS_RESOURCE_PATH = \"/org/osc/core/broker/util/crypto/security.properties\"",
"modifier": "public static final",
"original_string": "public static final String SECURITY_PROPS_RESOURCE_PATH = \"/org/osc/core/broker/util/crypto/security.properties\";",
... | {
"body": "static String encryptPbkdf2(String plainText) throws EncryptionException {\n return new PBKDF2Derivation().derive(plainText);\n }",
"class_method_signature": "EncryptionUtil.encryptPbkdf2(String plainText)",
"constructor": false,
"full_signature": "static String encryptPbkdf2(String plainTe... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_176 | {
"fields": [
{
"declarator": "factory",
"modifier": "@InjectMocks",
"original_string": "@InjectMocks\n RemovePortGroupHookTask factory;",
"type": "RemovePortGroupHookTask",
"var_name": "factory"
},
{
"declarator": "em",
"modifier": "@Mock\n protected",
... | {
"body": "@Test\n public void testExecute_WhenRemoveInspectionHookSucceeds_SGINetworkElementSetToNull() throws Exception {\n // Arrange.\n SecurityGroupInterface sgi = registerNewSGI(4L);\n\n SdnRedirectionApi redirectionApi = mockRemoveInspectionHook(sgi, null);\n\n registerNetworkRed... | {
"fields": [
{
"declarator": "sgi",
"modifier": "public",
"original_string": "public SecurityGroupInterface sgi;",
"type": "SecurityGroupInterface",
"var_name": "sgi"
},
{
"declarator": "LOG = LoggerFactory.getLogger(RemovePortGroupHookTask.class)",
"modifier": "... | {
"body": "public RemovePortGroupHookTask create(SecurityGroupInterface sgi){\n RemovePortGroupHookTask task = new RemovePortGroupHookTask();\n task.sgi = sgi;\n task.apiFactoryService = this.apiFactoryService;\n task.dbConnectionManager = this.dbConnectionManager;\n task.txBroadcas... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_199 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator":... | {
"body": "@Test\n public void testExecute_WithSecurityGroupSFCIdSetToNotEmpty_ExpectUpdate() throws Exception {\n // Arrange\n this.sg.setNetworkElementId(\"OLD_SFC_ID\");\n UpdateServiceFunctionChainTask updateTask = this.task.create(this.sg, this.networkElementList);\n Mockito.when(t... | {
"fields": [
{
"declarator": "apiFactory",
"modifier": "@Reference\n private",
"original_string": "@Reference\n private ApiFactoryService apiFactory;",
"type": "ApiFactoryService",
"var_name": "apiFactory"
},
{
"declarator": "sfc",
"modifier": "private",
... | {
"body": "public UpdateServiceFunctionChainTask create(SecurityGroup securityGroup,\n List<NetworkElement> updatedPortPairGroups) {\n UpdateServiceFunctionChainTask task = new UpdateServiceFunctionChainTask();\n\n task.sfc = securityGroup.getServiceFunctionChain();\n task.securityGrou... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_10 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator":... | {
"body": "@Test\n public void testUpdateDeploymentReplicaCount_WhenK8sReturnsNull_ThrowsVmidcException() throws Exception {\n // Arrange.\n String name = UUID.randomUUID().toString();\n String namespace = UUID.randomUUID().toString();\n mockDeploymentByName(namespace, name, null);\n ... | {
"fields": [
{
"declarator": "OSC_DEPLOYMENT_LABEL_NAME = \"osc-deployment\"",
"modifier": "public final static",
"original_string": "public final static String OSC_DEPLOYMENT_LABEL_NAME = \"osc-deployment\";",
"type": "String",
"var_name": "OSC_DEPLOYMENT_LABEL_NAME"
},
{
... | {
"body": "public void updateDeploymentReplicaCount(String uid, String namespace, String name, int replicaCount) throws VmidcException {\n if (uid == null) {\n throw new IllegalArgumentException(\"The uid should not be null\");\n }\n\n if (name == null) {\n throw new Illegal... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_249 | {
"fields": [],
"file": "osc-resolver/src/test/java/org/osc/core/server/resolver/impl/PluginResolveContextTest.java",
"identifier": "PluginResolveContextTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testEffectiveNonResolveCapsMatchRequirementWithSame() throws Exception {\n\t\t// Caps with effective=!resolve ONLY match reqs with the same effective\n\t\tassertTrue(\"effective should match: req=blah, cap=blah\", PluginResolveContext.match(\n\t\t\tcreateRequirement(\"foo\", \"(foo=bar... | {
"fields": [
{
"declarator": "INITIAL_RESOURCE_CAPABILITY_NAMESPACE = \"__initial\"",
"modifier": "private static final",
"original_string": "private static final String INITIAL_RESOURCE_CAPABILITY_NAMESPACE = \"__initial\";",
"type": "String",
"var_name": "INITIAL_RESOURCE_CAPABILI... | {
"body": "static boolean match(Requirement requirement, Capability capability) {\n\t\treturn match(requirement, capability, null);\n\t}",
"class_method_signature": "PluginResolveContext.match(Requirement requirement, Capability capability)",
"constructor": false,
"full_signature": "static boolean match(Require... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_160 | {
"fields": [
{
"declarator": "em",
"modifier": "@Mock\n protected",
"original_string": "@Mock\n protected EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "tx",
"modifier": "@Mock\n protected",
"original_string": "@M... | {
"body": "@Test\n public void testExecute_WhenLabelHasMultipleSGMs_LabelIsNotDelete()\n throws Exception {\n // Arrange.\n Label label = new Label(\"labelName\", \"labelValue\");\n SecurityGroup sg = new SecurityGroup(null, null, null);\n sg.setName(\"sgName\");\n\n l... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(SecurityGroupMemberDeleteTask.class)",
"modifier": "private final",
"original_string": "private final Logger log = LoggerFactory.getLogger(SecurityGroupMemberDeleteTask.class);",
"type": "Logger",
"var_name": "log"
},
... | {
"body": "public SecurityGroupMemberDeleteTask create(SecurityGroupMember sgm) {\n SecurityGroupMemberDeleteTask task = new SecurityGroupMemberDeleteTask();\n task.sgm = sgm;\n task.dbConnectionManager = this.dbConnectionManager;\n task.txBroadcastUtil = this.txBroadcastUtil;\n\n r... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_137 | {
"fields": [
{
"declarator": "em",
"modifier": "private",
"original_string": "private EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "txControl",
"modifier": "@Mock(answer = Answers.CALLS_REAL_METHODS)\n private",
"origi... | {
"body": "@Test\n public void testExecute_WithVariousSGM_ExpectCorrectTaskGraph() throws Exception {\n\n // Arrange.\n CheckK8sSecurityGroupLabelMetaTask task =\n this.factoryTask.create(this.sgm, this.isDelete);\n UpdateK8sSecurityGroupMemberLabelMetaTask updateK8sSecurityGrou... | {
"fields": [
{
"declarator": "tg",
"modifier": "private",
"original_string": "private TaskGraph tg;",
"type": "TaskGraph",
"var_name": "tg"
},
{
"declarator": "sgm",
"modifier": "private",
"original_string": "private SecurityGroupMember sgm;",
"type":... | {
"body": "public CheckK8sSecurityGroupLabelMetaTask create(SecurityGroupMember sgm, boolean isDelete) {\n CheckK8sSecurityGroupLabelMetaTask task = new CheckK8sSecurityGroupLabelMetaTask();\n task.sgm = sgm;\n task.isDelete = isDelete;\n task.updateK8sSecurityGroupMemberLabelMetaTask = th... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_51 | {
"fields": [
{
"declarator": "unEncryptedMessage = \"helloworld\"",
"modifier": "private",
"original_string": "private String unEncryptedMessage = \"helloworld\";",
"type": "String",
"var_name": "unEncryptedMessage"
},
{
"declarator": "aesCtrEncryptedMessage = \"af5b59... | {
"body": "@Test\n public void testEncryptAesCtr_WithNullMessage_ExpectsNull() throws EncryptionException {\n String encryption = new EncryptionUtil().encryptAESCTR(null);\n assertEquals(null, encryption);\n }",
"class_method_signature": "EncryptionUtilTest.testEncryptAesCtr_WithNullMessage_Expe... | {
"fields": [
{
"declarator": "SECURITY_PROPS_RESOURCE_PATH = \"/org/osc/core/broker/util/crypto/security.properties\"",
"modifier": "public static final",
"original_string": "public static final String SECURITY_PROPS_RESOURCE_PATH = \"/org/osc/core/broker/util/crypto/security.properties\";",
... | {
"body": "@Override\n public String encryptAESCTR(String plainText) throws EncryptionException {\n return new AESCTREncryption().encrypt(plainText);\n }",
"class_method_signature": "EncryptionUtil.encryptAESCTR(String plainText)",
"constructor": false,
"full_signature": "@Override public String en... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_136 | {
"fields": [
{
"declarator": "em",
"modifier": "public",
"original_string": "public EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "txControl",
"modifier": "@Mock(answer = Answers.CALLS_REAL_METHODS)\n private",
"origina... | {
"body": "@Test\n public void testExecute_WithVariousSecurityGroups_ExpectsCorrectTaskGraph() throws Exception {\n // Arrange.\n this.factoryTask.checkK8sSecurityGroupLabelMetaTask = new CheckK8sSecurityGroupLabelMetaTask();\n this.factoryTask.portGroupCheckMetaTask = new PortGroupCheckMetaTa... | {
"fields": [
{
"declarator": "checkK8sSecurityGroupLabelMetaTask",
"modifier": "@Reference",
"original_string": "@Reference\n CheckK8sSecurityGroupLabelMetaTask checkK8sSecurityGroupLabelMetaTask;",
"type": "CheckK8sSecurityGroupLabelMetaTask",
"var_name": "checkK8sSecurityGroupL... | {
"body": "public UpdateOrDeleteK8sSecurityGroupMetaTask create(SecurityGroup sg) {\n UpdateOrDeleteK8sSecurityGroupMetaTask task = new UpdateOrDeleteK8sSecurityGroupMetaTask();\n task.sg = sg;\n task.checkK8sSecurityGroupLabelMetaTask = this.checkK8sSecurityGroupLabelMetaTask;\n task.port... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_50 | {
"fields": [
{
"declarator": "unEncryptedMessage = \"helloworld\"",
"modifier": "private",
"original_string": "private String unEncryptedMessage = \"helloworld\";",
"type": "String",
"var_name": "unEncryptedMessage"
},
{
"declarator": "aesCtrEncryptedMessage = \"af5b59... | {
"body": "@Test\n public void testEncryptAesCtr_WithEmptyMessage_ExpectsEmptyMessage() throws EncryptionException {\n String encryption = new EncryptionUtil().encryptAESCTR(\"\");\n assertEquals(\"\", encryption);\n }",
"class_method_signature": "EncryptionUtilTest.testEncryptAesCtr_WithEmptyMe... | {
"fields": [
{
"declarator": "SECURITY_PROPS_RESOURCE_PATH = \"/org/osc/core/broker/util/crypto/security.properties\"",
"modifier": "public static final",
"original_string": "public static final String SECURITY_PROPS_RESOURCE_PATH = \"/org/osc/core/broker/util/crypto/security.properties\";",
... | {
"body": "@Override\n public String encryptAESCTR(String plainText) throws EncryptionException {\n return new AESCTREncryption().encrypt(plainText);\n }",
"class_method_signature": "EncryptionUtil.encryptAESCTR(String plainText)",
"constructor": false,
"full_signature": "@Override public String en... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_161 | {
"fields": [
{
"declarator": "em",
"modifier": "@Mock\n protected",
"original_string": "@Mock\n protected EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "tx",
"modifier": "@Mock\n protected",
"original_string": "@M... | {
"body": "@Test\n public void testExecute_WhenLabelHasSingleSGM_PodAndPodPortAreNotDeleted()\n throws Exception {\n // Arrange.\n Label label = new Label(\"labelName\", \"labelValue\");\n SecurityGroup sg = new SecurityGroup(null, null, null);\n sg.setName(\"sgName\");\n\n ... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(SecurityGroupMemberDeleteTask.class)",
"modifier": "private final",
"original_string": "private final Logger log = LoggerFactory.getLogger(SecurityGroupMemberDeleteTask.class);",
"type": "Logger",
"var_name": "log"
},
... | {
"body": "public SecurityGroupMemberDeleteTask create(SecurityGroupMember sgm) {\n SecurityGroupMemberDeleteTask task = new SecurityGroupMemberDeleteTask();\n task.sgm = sgm;\n task.dbConnectionManager = this.dbConnectionManager;\n task.txBroadcastUtil = this.txBroadcastUtil;\n\n r... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_248 | {
"fields": [],
"file": "osc-resolver/src/test/java/org/osc/core/server/resolver/impl/PluginResolveContextTest.java",
"identifier": "PluginResolveContextTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testEffectiveResolveCapsMatchAnyRequirement() throws Exception {\n\t\t// Caps with effective=resolve (or default) match requirements with any effective=...\n\t\tassertTrue(\"effective should match: req=blah, cap=default\", PluginResolveContext.match(\n\t\t\tcreateRequirement(\"foo\", \... | {
"fields": [
{
"declarator": "INITIAL_RESOURCE_CAPABILITY_NAMESPACE = \"__initial\"",
"modifier": "private static final",
"original_string": "private static final String INITIAL_RESOURCE_CAPABILITY_NAMESPACE = \"__initial\";",
"type": "String",
"var_name": "INITIAL_RESOURCE_CAPABILI... | {
"body": "static boolean match(Requirement requirement, Capability capability) {\n\t\treturn match(requirement, capability, null);\n\t}",
"class_method_signature": "PluginResolveContext.match(Requirement requirement, Capability capability)",
"constructor": false,
"full_signature": "static boolean match(Require... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_177 | {
"fields": [
{
"declarator": "em",
"modifier": "public",
"original_string": "public EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "txControl",
"modifier": "@Mock(answer = Answers.CALLS_REAL_METHODS)\n private",
"origina... | {
"body": "@Test\n public void testExecuteTransaction_WithVariousSecurityGroups_ExpectsCorrectTaskGraph() throws Exception {\n // Arrange.\n this.factoryTask.createPortGroupTask = new CreatePortGroupTask();\n this.factoryTask.updatePortGroupTask = new UpdatePortGroupTask();\n this.facto... | {
"fields": [
{
"declarator": "createPortGroupTask",
"modifier": "@Reference",
"original_string": "@Reference\n CreatePortGroupTask createPortGroupTask;",
"type": "CreatePortGroupTask",
"var_name": "createPortGroupTask"
},
{
"declarator": "updatePortGroupTask",
... | {
"body": "public PortGroupCheckMetaTask create(SecurityGroup sg, boolean deleteTg, String domainId) {\n PortGroupCheckMetaTask task = new PortGroupCheckMetaTask();\n task.createPortGroupTask = this.createPortGroupTask;\n task.updatePortGroupTask = this.updatePortGroupTask;\n task.deletePo... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_198 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator":... | {
"body": "@Test\n public void testExecute_WithSecurityGroupSFCIdSetToNull_ExpectUpdate() throws Exception {\n // Arrange\n UpdateServiceFunctionChainTask updateTask = this.task.create(this.sg, this.networkElementList);\n this.sg.setNetworkElementId(null);\n Mockito.when(this.sdnApi\n ... | {
"fields": [
{
"declarator": "apiFactory",
"modifier": "@Reference\n private",
"original_string": "@Reference\n private ApiFactoryService apiFactory;",
"type": "ApiFactoryService",
"var_name": "apiFactory"
},
{
"declarator": "sfc",
"modifier": "private",
... | {
"body": "public UpdateServiceFunctionChainTask create(SecurityGroup securityGroup,\n List<NetworkElement> updatedPortPairGroups) {\n UpdateServiceFunctionChainTask task = new UpdateServiceFunctionChainTask();\n\n task.sfc = securityGroup.getServiceFunctionChain();\n task.securityGrou... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_11 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator":... | {
"body": "@Test\n public void testUpdateDeploymentReplicaCount_WhenK8sReturnsDeploymentWithMismatchingId_ReturnsNull() throws Exception {\n // Arrange.\n String name = UUID.randomUUID().toString();\n String namespace = UUID.randomUUID().toString();\n mockDeploymentByName(namespace, nam... | {
"fields": [
{
"declarator": "OSC_DEPLOYMENT_LABEL_NAME = \"osc-deployment\"",
"modifier": "public final static",
"original_string": "public final static String OSC_DEPLOYMENT_LABEL_NAME = \"osc-deployment\";",
"type": "String",
"var_name": "OSC_DEPLOYMENT_LABEL_NAME"
},
{
... | {
"body": "public void updateDeploymentReplicaCount(String uid, String namespace, String name, int replicaCount) throws VmidcException {\n if (uid == null) {\n throw new IllegalArgumentException(\"The uid should not be null\");\n }\n\n if (name == null) {\n throw new Illegal... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_120 | {
"fields": [
{
"declarator": "em",
"modifier": "public",
"original_string": "public EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "txControl",
"modifier": "@Mock(answer = Answers.CALLS_REAL_METHODS)\n private",
"origina... | {
"body": "@Test\n public void testExecuteTransaction_WithVariousDeploymentSpecs_ExpectsCorrectTaskGraph() throws Exception {\n // Arrange.\n this.factoryTask.createK8sDeploymentTask = new CreateK8sDeploymentTask();\n this.factoryTask.updateK8sDeploymentTask = new UpdateK8sDeploymentTask();\n ... | {
"fields": [
{
"declarator": "createK8sDeploymentTask",
"modifier": "@Reference",
"original_string": "@Reference\n CreateK8sDeploymentTask createK8sDeploymentTask;",
"type": "CreateK8sDeploymentTask",
"var_name": "createK8sDeploymentTask"
},
{
"declarator": "updateK... | {
"body": "CreateOrUpdateK8sDeploymentSpecMetaTask create(DeploymentSpec ds, KubernetesDeploymentApi k8sDeploymentApi) {\n CreateOrUpdateK8sDeploymentSpecMetaTask task = new CreateOrUpdateK8sDeploymentSpecMetaTask();\n task.createK8sDeploymentTask = this.createK8sDeploymentTask;\n task.updateK8sD... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_46 | {
"fields": [
{
"declarator": "unEncryptedMessage = \"helloworld\"",
"modifier": "private",
"original_string": "private String unEncryptedMessage = \"helloworld\";",
"type": "String",
"var_name": "unEncryptedMessage"
},
{
"declarator": "aesCtrEncryptedMessage = \"af5b59... | {
"body": "@Test\n public void testEncryptPbkdf2_WithValidMessage_ExpectsPbkdf2Hash() throws EncryptionException {\n String encryption = EncryptionUtil.encryptPbkdf2(this.unEncryptedMessage);\n assertTrue(encryption.startsWith(\"4000\"));\n assertEquals(encryption.length(), 102);\n }",
"c... | {
"fields": [
{
"declarator": "SECURITY_PROPS_RESOURCE_PATH = \"/org/osc/core/broker/util/crypto/security.properties\"",
"modifier": "public static final",
"original_string": "public static final String SECURITY_PROPS_RESOURCE_PATH = \"/org/osc/core/broker/util/crypto/security.properties\";",
... | {
"body": "static String encryptPbkdf2(String plainText) throws EncryptionException {\n return new PBKDF2Derivation().derive(plainText);\n }",
"class_method_signature": "EncryptionUtil.encryptPbkdf2(String plainText)",
"constructor": false,
"full_signature": "static String encryptPbkdf2(String plainTe... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_209 | {
"fields": [
{
"declarator": "txBroadcastUtil",
"modifier": "@Mock\n private",
"original_string": "@Mock\n private TransactionalBroadcastUtil txBroadcastUtil;",
"type": "TransactionalBroadcastUtil",
"var_name": "txBroadcastUtil"
},
{
"declarator": "em",
"mo... | {
"body": "@Test\n public void testRun_WithInvalidEntityId_ThrowsIllegalArgumentException() throws Exception {\n // Assert.\n this.expectException.expect(IllegalArgumentException.class);\n\n // Act.\n this.target.run(this.em,new CompleteJobTransactionInput(this.missingEntityId, this.exi... | {
"fields": [
{
"declarator": "entityType",
"modifier": "private",
"original_string": "private Class<T> entityType;",
"type": "Class<T>",
"var_name": "entityType"
},
{
"declarator": "txBroadcastUtil",
"modifier": "private",
"original_string": "private Transa... | {
"body": "public Void run(EntityManager em, CompleteJobTransactionInput param) throws Exception {\n T entity = em.find(this.entityType, param.getEntityId());\n\n if (entity == null) {\n throw new IllegalArgumentException(String.format(\"Entity with Id '%d' does not exist.\", param.getEntityI... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_85 | {
"fields": [
{
"declarator": "oldProcessId = \"10000\"",
"modifier": "private final",
"original_string": "private final String oldProcessId = \"10000\";",
"type": "String",
"var_name": "oldProcessId"
},
{
"declarator": "linuxProcessExec = \"ps \"",
"modifier": "p... | {
"body": "@Test\n public void testReadPIDFromFile_WithValidPIDFile_ReturnsNumericPID() throws IOException, CorruptedPidException {\n // Arrange.\n Files.write(this.regularFile.toPath(), \"1000\".getBytes(), StandardOpenOption.APPEND);\n\n // Act.\n Integer pidFromFile = ServerUtil.read... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(ServerUtil.class)",
"modifier": "private static final",
"original_string": "private static final Logger log = LoggerFactory.getLogger(ServerUtil.class);",
"type": "Logger",
"var_name": "log"
},
{
"declarator":... | {
"body": "static Integer readPIDFromFile(String filename) throws CorruptedPidException {\n if (!new File(filename).exists()) {\n return null;\n }\n\n String PID = null;\n try (BufferedReader in = new BufferedReader(new FileReader(filename))){\n PID = in.readLine();\n... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_225 | {
"fields": [
{
"declarator": "em",
"modifier": "@Mock\n private",
"original_string": "@Mock\n private EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "txBroadcastUtil",
"modifier": "@Mock\n private",
"original_strin... | {
"body": "@Test\n public void testValidateForCreate_WithExistingUser_ThrowsInvalidEntryException() throws Exception {\n // Arrange.\n this.exception.expect(VmidcBrokerValidationException.class);\n this.exception.expectMessage(MessageFormat.format(\"User Login Name: {0} already exists.\", this... | {
"fields": [
{
"declarator": "em",
"modifier": "",
"original_string": "EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "txBroadcastUtil",
"modifier": "private",
"original_string": "private TransactionalBroadcastUtil txBroadc... | {
"body": "@Override\n public void validateForCreate(UserDto dto) throws Exception {\n validate(dto);\n\n OSCEntityManager<User> emgr = new OSCEntityManager<User>(User.class, this.em, this.txBroadcastUtil);\n\n if (emgr.isExisting(\"loginName\", dto.getLoginName())) {\n throw new Vm... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_93 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator":... | {
"body": "@Test\n public void testConnection_WithKubernetes_WithIgnoreProviderException_WhenSdnControllerStatusSuccess_ReturnsSuccessful() throws Exception {\n // Arrange.\n DryRunRequest<VirtualizationConnectorRequest> request = VirtualizationConnectorUtilTestData.generateK8sVCWithSDN();\n\n ... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(VirtualizationConnectorUtil.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(VirtualizationConnectorUtil.class);",
"type": "Logger",
"var_name": "LOG... | {
"body": "public <T extends VirtualizationConnectorDto> void checkConnection(DryRunRequest<T> request, VirtualizationConnector vc) throws Exception {\n if (!request.isSkipAllDryRun()) {\n ErrorTypeException errorTypeException = null;\n final ArrayList<CertificateResolverModel> certifica... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_233 | {
"fields": [],
"file": "osc-server/src/test/java/org/osc/core/broker/service/validator/VirtualizationConnectorDtoValidatorTest.java",
"identifier": "VirtualizationConnectorDtoValidatorTest",
"interfaces": "",
"superclass": "extends VirtualizationConnectorDtoValidatorBaseTest"
} | {
"body": "@Test\n public void testValidateForCreate_WhenProviderIpExists_ThrowsValidationException() throws Exception {\n // Arrange.\n this.exception.expect(VmidcBrokerValidationException.class);\n VirtualizationConnectorDto dto = VirtualizationConnectorDtoValidatorTestData.PROVIDER_IP_ALREA... | {
"fields": [
{
"declarator": "em",
"modifier": "private",
"original_string": "private EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "txBroadcastUtil",
"modifier": "private",
"original_string": "private TransactionalBroadca... | {
"body": "@Override\n public void validateForCreate(VirtualizationConnectorDto dto) throws Exception {\n // Initializing Entity Manager\n OSCEntityManager<VirtualizationConnector> emgr = new OSCEntityManager<>(\n VirtualizationConnector.class, this.em, this.txBroadcastUtil);\n\n ... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_213 | {
"fields": [],
"file": "osc-server/src/test/java/org/osc/core/broker/service/validator/DistributedApplianceDtoValidatorTest.java",
"identifier": "DistributedApplianceDtoValidatorTest",
"interfaces": "",
"superclass": "extends DistributedApplianceDtoValidatorBaseTest"
} | {
"body": "@Test\n public void testValidateForCreate_WhenDistributedApplianceExists_ThrowsValidationException() throws Exception {\n // Arrange.\n DistributedApplianceDto existingDaDto= createDistributedApplianceDto();\n existingDaDto.setName(DA_NAME_EXISTING_DA);\n existingDaDto.setApp... | {
"fields": [
{
"declarator": "em",
"modifier": "private",
"original_string": "private EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "ENCAPSULATION_TYPE_FIELD = \"Encapsulation Type\"",
"modifier": "private final static",
"... | {
"body": "@Override\n public void validateForCreate(DistributedApplianceDto dto) throws Exception {\n validate(dto);\n\n OSCEntityManager<DistributedAppliance> emgr = new OSCEntityManager<DistributedAppliance>(DistributedAppliance.class,\n this.em, this.txBroadcastUtil);\n\n if... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_244 | {
"fields": [
{
"declarator": "je",
"modifier": "",
"original_string": "JobEngine je;",
"type": "JobEngine",
"var_name": "je"
},
{
"declarator": "tg",
"modifier": "",
"original_string": "TaskGraph tg;",
"type": "TaskGraph",
"var_name": "tg"
}... | {
"body": "@Test\n public void testMetaTask() throws Exception {\n EmptyTask A = new EmptyTask(\"TG-A\");\n EmptyMetaTask B = new EmptyMetaTask(\"TG-B (Meta)\");\n EmptyTask C = new EmptyTask(\"TG-C\");\n EmptyTask D = new EmptyTask(\"TG-D\");\n\n this.tg = new TaskGraph();\n ... | {
"fields": [
{
"declarator": "DEFAULT_JOB_THREAD_POOL_SIZE = 10",
"modifier": "public static final",
"original_string": "public static final int DEFAULT_JOB_THREAD_POOL_SIZE = 10;",
"type": "int",
"var_name": "DEFAULT_JOB_THREAD_POOL_SIZE"
},
{
"declarator": "DEFAULT_T... | {
"body": "public Job submit(String name, TaskGraph taskGraph, JobCompletionListener listener, boolean persistent)\n throws Exception {\n return initJob(name, taskGraph, null, listener, null, persistent);\n }",
"class_method_signature": "JobEngine.submit(String name, TaskGraph taskGraph, JobCom... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_182 | {
"fields": [
{
"declarator": "factory",
"modifier": "@InjectMocks",
"original_string": "@InjectMocks\n DeallocateDAIOfSGIMembersTask factory;",
"type": "DeallocateDAIOfSGIMembersTask",
"var_name": "factory"
}
],
"file": "osc-server/src/test/java/org/osc/core/broker/servic... | {
"body": "@Test\n public void testExecute_WhenDaiHasOtherProtectedPorts_ExtraProtectedPortRemains() throws Exception {\n // Arrange.\n SecurityGroup sg = new SecurityGroup(null, null, null);\n sg.addSecurityGroupMember(newSGMWithPort(VM.class, 1L));\n\n SecurityGroupInterface sgi = reg... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(AllocateDAIWithSGIMembersTask.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(AllocateDAIWithSGIMembersTask.class);",
"type": "Logger",
"var_name": ... | {
"body": "@Override\n public DeallocateDAIOfSGIMembersTask create(SecurityGroupInterface sgi, DistributedApplianceInstance dai) {\n DeallocateDAIOfSGIMembersTask task = new DeallocateDAIOfSGIMembersTask(sgi, dai);\n task.dbConnectionManager = this.dbConnectionManager;\n task.txBroadcastUtil =... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_194 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n\tpublic",
"original_string": "@Rule\n\tpublic ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "em... | {
"body": "@Test\n\tpublic void testExecute_WhenDeleteNetworkElementFails_ThrowsUnhandledException() throws Exception {\n\t\t// Arrange\n\t\tDeleteServiceFunctionChainTask deleteTask = this.task.create(SG_SFC_FAIL_ELEMENT_EXISTS);\n\n\t\tmockDeleteNetworkElement(SG_SFC_FAIL_ELEMENT_EXISTS,\n\t\t\t\tnew NetworkElement... | {
"fields": [
{
"declarator": "apiFactory",
"modifier": "@Reference\n\tprivate",
"original_string": "@Reference\n\tprivate ApiFactoryService apiFactory;",
"type": "ApiFactoryService",
"var_name": "apiFactory"
},
{
"declarator": "securityGroup",
"modifier": "privat... | {
"body": "public DeleteServiceFunctionChainTask create(SecurityGroup securityGroup) {\n\t\tDeleteServiceFunctionChainTask task = new DeleteServiceFunctionChainTask();\n\n\t\ttask.securityGroup = securityGroup;\n\t\ttask.apiFactory = this.apiFactory;\n\t\ttask.name = task.getName();\n\t\ttask.dbConnectionManager = th... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_205 | {
"fields": [
{
"declarator": "INSPECTION_HOOK_ID = \"inspection-hook-id\"",
"modifier": "private static final",
"original_string": "private static final String INSPECTION_HOOK_ID = \"inspection-hook-id\";",
"type": "String",
"var_name": "INSPECTION_HOOK_ID"
},
{
"decla... | {
"body": "@Test\n public void testExecute_WithInspectionHook_ExpectFailure() throws Exception {\n // Arrange\n doThrow(new Exception()).when(this.sdnApi).removeInspectionHook(INSPECTION_HOOK_ID);\n\n this.exception.expect(Exception.class);\n\n SfcFlowClassifierDeleteTask deleteTask = t... | {
"fields": [
{
"declarator": "apiFactory",
"modifier": "@Reference\n private",
"original_string": "@Reference\n private ApiFactoryService apiFactory;",
"type": "ApiFactoryService",
"var_name": "apiFactory"
},
{
"declarator": "securityGroup",
"modifier": "pr... | {
"body": "public SfcFlowClassifierDeleteTask create(SecurityGroup securityGroup, VMPort port) {\n SfcFlowClassifierDeleteTask task = new SfcFlowClassifierDeleteTask();\n\n task.securityGroup = securityGroup;\n task.port = port;\n task.vmName = port.getVm() != null ? port.getVm().getName()... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_1 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator":... | {
"body": "@Test\n public void testGetDeploymentbyId_WhenK8sReturnsNull_ReturnsNull() throws Exception {\n // Arrange.\n String name = UUID.randomUUID().toString();\n String namespace = UUID.randomUUID().toString();\n mockDeploymentByName(namespace, name, null);\n\n // Act.\n ... | {
"fields": [
{
"declarator": "OSC_DEPLOYMENT_LABEL_NAME = \"osc-deployment\"",
"modifier": "public final static",
"original_string": "public final static String OSC_DEPLOYMENT_LABEL_NAME = \"osc-deployment\";",
"type": "String",
"var_name": "OSC_DEPLOYMENT_LABEL_NAME"
},
{
... | {
"body": "public KubernetesDeployment getDeploymentById(String uid, String namespace, String name) throws VmidcException {\n if (uid == null) {\n throw new IllegalArgumentException(\"Uid should not be null\");\n }\n\n if (name == null) {\n throw new IllegalArgumentException... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_31 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator":... | {
"body": "@Test\n public void testGetPodsbyLabel_WhenK8sReturnsPodWithMismatchingId_ReturnsEmptyList() throws Exception {\n // Arrange.\n String name = UUID.randomUUID().toString();\n String namespace = UUID.randomUUID().toString();\n mockPodsByName(namespace, name, newPod(UUID.randomU... | {
"fields": [],
"file": "osc-server/src/main/java/org/osc/core/broker/rest/client/k8s/KubernetesPodApi.java",
"identifier": "KubernetesPodApi",
"interfaces": "",
"methods": [
{
"class_method_signature": "KubernetesPodApi.KubernetesPodApi(KubernetesClient client)",
"constructor": true,
"f... | {
"body": "public KubernetesPod getPodById(String uid, String namespace, String name) throws VmidcException {\n if (uid == null) {\n throw new IllegalArgumentException(\"Uid should not be null\");\n }\n\n if (name == null) {\n throw new IllegalArgumentException(\"Name should... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_157 | {
"fields": [
{
"declarator": "em",
"modifier": "@Mock\n protected",
"original_string": "@Mock\n protected EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "tx",
"modifier": "@Mock\n protected",
"original_string": "@M... | {
"body": "@Test\n public void testExecute_SGWithOneSGM_ExecutionFinishes() throws Exception {\n // Arrange.\n SecurityGroup sg = registerSecurityGroup(1L, \"projectId\", \"projectName\", 1L, \"sgName\");\n sg.addSecurityGroupMember(newSGMWithPort(1L));\n\n List<NetworkElement> neList =... | {
"fields": [
{
"declarator": "apiFactoryService",
"modifier": "@Reference\n private",
"original_string": "@Reference\n private ApiFactoryService apiFactoryService;",
"type": "ApiFactoryService",
"var_name": "apiFactoryService"
},
{
"declarator": "securityGroup",
... | {
"body": "public CreatePortGroupTask create(SecurityGroup sg) {\n CreatePortGroupTask task = new CreatePortGroupTask();\n task.securityGroup = sg;\n task.apiFactoryService = this.apiFactoryService;\n task.dbConnectionManager = this.dbConnectionManager;\n task.txBroadcastUtil = this... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_229 | {
"fields": [
{
"declarator": "em",
"modifier": "@Mock\n private",
"original_string": "@Mock\n private EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "txBroadcastUtil",
"modifier": "@Mock\n private",
"original_strin... | {
"body": "@Test\n public void testValidateForUpdate_WhenUserNotFound_ThrowsInvalidEntryException() throws Exception {\n // Arrange.\n Long idNotFound = 10L;\n this.existingUserDto.setId(idNotFound);\n this.exception.expect(VmidcBrokerValidationException.class);\n this.exception.... | {
"fields": [
{
"declarator": "em",
"modifier": "",
"original_string": "EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "txBroadcastUtil",
"modifier": "private",
"original_string": "private TransactionalBroadcastUtil txBroadc... | {
"body": "@Override\n public User validateForUpdate(UserDto dto) throws Exception {\n BaseDtoValidator.checkForNullId(dto);\n\n validate(dto);\n\n OSCEntityManager<User> emgr = new OSCEntityManager<User>(User.class, this.em, this.txBroadcastUtil);\n\n User user = emgr.findByPrimaryKey(... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_66 | {
"fields": [
{
"declarator": "USER = \"admin\"",
"modifier": "private static final",
"original_string": "private static final String USER = \"admin\";",
"type": "String",
"var_name": "USER"
},
{
"declarator": "PASSWORD = \"admin123\"",
"modifier": "private static... | {
"body": "@Test(expected = WebApplicationException.class)\n public void testAuthenticateLocalRequestMissing() {\n this.authUtil.authenticateLocalRequest(this.mockRequest);\n }",
"class_method_signature": "AuthUtilTest.testAuthenticateLocalRequestMissing()",
"constructor": false,
"full_signature": ... | {
"fields": [
{
"declarator": "encrypter",
"modifier": "@Reference",
"original_string": "@Reference\n EncryptionApi encrypter;",
"type": "EncryptionApi",
"var_name": "encrypter"
},
{
"declarator": "logging",
"modifier": "@Reference",
"original_string": "@... | {
"body": "public void authenticateLocalRequest(ContainerRequestContext request) {\n WebApplicationException wae = new WebApplicationException(\n Response.status(Response.Status.UNAUTHORIZED).entity(\"not authorized\").build());\n if(request.getUriInfo()!=null && request.getUriInfo().getR... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_100 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator":... | {
"body": "@Test\n public void testConnection_WithOpenStack_WithIgnoreControllerException_WithIgnoreProviderException_WhenRabbitClientConnectionSuccess_ReturnsSuccessful() throws Throwable {\n // Arrange.\n DryRunRequest<VirtualizationConnectorRequest> request = VirtualizationConnectorUtilTestData.ge... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(VirtualizationConnectorUtil.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(VirtualizationConnectorUtil.class);",
"type": "Logger",
"var_name": "LOG... | {
"body": "public <T extends VirtualizationConnectorDto> void checkConnection(DryRunRequest<T> request, VirtualizationConnector vc) throws Exception {\n if (!request.isSkipAllDryRun()) {\n ErrorTypeException errorTypeException = null;\n final ArrayList<CertificateResolverModel> certifica... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_89 | {
"fields": [
{
"declarator": "oldProcessId = \"10000\"",
"modifier": "private final",
"original_string": "private final String oldProcessId = \"10000\";",
"type": "String",
"var_name": "oldProcessId"
},
{
"declarator": "linuxProcessExec = \"ps \"",
"modifier": "p... | {
"body": "@Test\n public void testDeletePidFileIfOwned_WithProperPidFile_RemovesPIDFile() throws IOException {\n // Arrange.\n mockGetCurrentPid(\"1000\");\n Files.write(this.regularFile.toPath(), \"1000\".getBytes(), StandardOpenOption.APPEND);\n Assert.assertTrue(this.regularFile.exi... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(ServerUtil.class)",
"modifier": "private static final",
"original_string": "private static final Logger log = LoggerFactory.getLogger(ServerUtil.class);",
"type": "Logger",
"var_name": "log"
},
{
"declarator":... | {
"body": "public static void deletePidFileIfOwned(String filename) {\n Integer filePid;\n\n try {\n filePid = readPIDFromFile(filename);\n } catch (CorruptedPidException e) {\n log.error(\"PID number is corrupted\", e);\n return;\n }\n\n if (filePid... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_70 | {
"fields": [
{
"declarator": "USER = \"admin\"",
"modifier": "private static final",
"original_string": "private static final String USER = \"admin\";",
"type": "String",
"var_name": "USER"
},
{
"declarator": "PASSWORD = \"admin123\"",
"modifier": "private static... | {
"body": "@Test\n public void validAuthenticateLocalRequestByDomain() throws URISyntaxException {\n Mockito.when(this.uriInfo.getRequestUri()).thenReturn(new URI(\"http://localhost\"));\n Mockito.when(this.mockRequest.getUriInfo()).thenReturn(this.uriInfo);\n this.authUtil.authenticateLocalRe... | {
"fields": [
{
"declarator": "encrypter",
"modifier": "@Reference",
"original_string": "@Reference\n EncryptionApi encrypter;",
"type": "EncryptionApi",
"var_name": "encrypter"
},
{
"declarator": "logging",
"modifier": "@Reference",
"original_string": "@... | {
"body": "public void authenticateLocalRequest(ContainerRequestContext request) {\n WebApplicationException wae = new WebApplicationException(\n Response.status(Response.Status.UNAUTHORIZED).entity(\"not authorized\").build());\n if(request.getUriInfo()!=null && request.getUriInfo().getR... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_116 | {
"fields": [
{
"declarator": "em",
"modifier": "@Mock\n protected",
"original_string": "@Mock\n protected EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "tx",
"modifier": "@Mock\n protected",
"original_string": "@M... | {
"body": "@Test\n public void testExecute_WhenCreateDeploymentSucceeds_DSIsUpdatedWithK8sDeploymentID() throws Exception {\n // Arrange.\n VirtualizationConnector vc = new VirtualizationConnector();\n vc.setProviderIpAddress(\"1.1.1.1\");\n VirtualSystem vs = new VirtualSystem(null);\n... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(CreateK8sDeploymentTask.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(CreateK8sDeploymentTask.class);",
"type": "Logger",
"var_name": "LOG"
},... | {
"body": "CreateK8sDeploymentTask create(DeploymentSpec ds, KubernetesDeploymentApi k8sDeploymentApi) {\n CreateK8sDeploymentTask task = new CreateK8sDeploymentTask();\n task.dbConnectionManager = this.dbConnectionManager;\n task.txBroadcastUtil = this.txBroadcastUtil;\n task.ds = ds;\n ... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_27 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator":... | {
"body": "@Test\n public void testGetPodsbyId_WithNullUid_ThrowsIllegalArgumentException() throws Exception {\n // Arrange.\n this.exception.expect(IllegalArgumentException.class);\n\n // Act.\n this.service.getPodById(null, \"sample_name\", \"sample_namespace\");\n }",
"class_met... | {
"fields": [],
"file": "osc-server/src/main/java/org/osc/core/broker/rest/client/k8s/KubernetesPodApi.java",
"identifier": "KubernetesPodApi",
"interfaces": "",
"methods": [
{
"class_method_signature": "KubernetesPodApi.KubernetesPodApi(KubernetesClient client)",
"constructor": true,
"f... | {
"body": "public KubernetesPod getPodById(String uid, String namespace, String name) throws VmidcException {\n if (uid == null) {\n throw new IllegalArgumentException(\"Uid should not be null\");\n }\n\n if (name == null) {\n throw new IllegalArgumentException(\"Name should... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_141 | {
"fields": [
{
"declarator": "em",
"modifier": "public",
"original_string": "public EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": ... | {
"body": "@Test\n public void testExecute_WithAValidExistingPod_LabelIsUpdatedWithExistingPod() throws Exception {\n // Arrange.\n CreateK8sLabelPodTask task = this.factoryTask.create(SAME_SG_ALREADY_PROTECTED_K8S_POD, VALID_EXISTING_POD_SGM_LABEL);\n NetworkElement podPort = SAME_SG_ALREADY_... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(CreateK8sLabelPodTask.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(CreateK8sLabelPodTask.class);",
"type": "Logger",
"var_name": "LOG"
},
... | {
"body": "public CreateK8sLabelPodTask create(KubernetesPod k8sPod, Label label) {\n CreateK8sLabelPodTask task = new CreateK8sLabelPodTask();\n task.k8sPod = k8sPod;\n task.label = label;\n task.apiFactoryService = this.apiFactoryService;\n task.dbConnectionManager = this.dbConnec... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_210 | {
"fields": [
{
"declarator": "txBroadcastUtil",
"modifier": "@Mock\n private",
"original_string": "@Mock\n private TransactionalBroadcastUtil txBroadcastUtil;",
"type": "TransactionalBroadcastUtil",
"var_name": "txBroadcastUtil"
},
{
"declarator": "em",
"mo... | {
"body": "@Test\n public void testRun_WithInvalidJobId_ThrowsIllegalArgumentException() throws Exception {\n // Assert.\n this.expectException.expect(IllegalArgumentException.class);\n\n // Act.\n this.target.run(this.em,new CompleteJobTransactionInput(this.existingEntityId, this.missi... | {
"fields": [
{
"declarator": "entityType",
"modifier": "private",
"original_string": "private Class<T> entityType;",
"type": "Class<T>",
"var_name": "entityType"
},
{
"declarator": "txBroadcastUtil",
"modifier": "private",
"original_string": "private Transa... | {
"body": "public Void run(EntityManager em, CompleteJobTransactionInput param) throws Exception {\n T entity = em.find(this.entityType, param.getEntityId());\n\n if (entity == null) {\n throw new IllegalArgumentException(String.format(\"Entity with Id '%d' does not exist.\", param.getEntityI... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_139 | {
"fields": [
{
"declarator": "em",
"modifier": "public",
"original_string": "public EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": ... | {
"body": "@Test\n public void testExecute_WhenSDNReturnsNullNetworkElement_ThrowsVmidcException() throws Exception {\n // Arrange.\n CreateK8sLabelPodTask task = this.factoryTask.create(NETWORK_ELEMENT_NOT_FOUND_K8S_POD, NETWORK_ELEMENT_NOT_FOUND_POD_SGM_LABEL);\n registerNetworkElement(NETWO... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(CreateK8sLabelPodTask.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(CreateK8sLabelPodTask.class);",
"type": "Logger",
"var_name": "LOG"
},
... | {
"body": "public CreateK8sLabelPodTask create(KubernetesPod k8sPod, Label label) {\n CreateK8sLabelPodTask task = new CreateK8sLabelPodTask();\n task.k8sPod = k8sPod;\n task.label = label;\n task.apiFactoryService = this.apiFactoryService;\n task.dbConnectionManager = this.dbConnec... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_247 | {
"fields": [],
"file": "osc-resolver/src/test/java/org/osc/core/server/resolver/impl/PluginResolveContextTest.java",
"identifier": "PluginResolveContextTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testMatchRequirementsEffectiveResolve() throws Exception {\n\t\tassertTrue(\"effective should match: req=default, cap=default\", PluginResolveContext.match(\n\t\t\tcreateRequirement(\"foo\", \"(foo=bar)\", null),\n\t\t\tcreateCapability(\"foo\", null, new HashMap<String,Object>() {{\n\... | {
"fields": [
{
"declarator": "INITIAL_RESOURCE_CAPABILITY_NAMESPACE = \"__initial\"",
"modifier": "private static final",
"original_string": "private static final String INITIAL_RESOURCE_CAPABILITY_NAMESPACE = \"__initial\";",
"type": "String",
"var_name": "INITIAL_RESOURCE_CAPABILI... | {
"body": "static boolean match(Requirement requirement, Capability capability) {\n\t\treturn match(requirement, capability, null);\n\t}",
"class_method_signature": "PluginResolveContext.match(Requirement requirement, Capability capability)",
"constructor": false,
"full_signature": "static boolean match(Require... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_181 | {
"fields": [
{
"declarator": "factory",
"modifier": "@InjectMocks",
"original_string": "@InjectMocks\n DeallocateDAIOfSGIMembersTask factory;",
"type": "DeallocateDAIOfSGIMembersTask",
"var_name": "factory"
}
],
"file": "osc-server/src/test/java/org/osc/core/broker/servic... | {
"body": "@Test\n public void testExecute_WhenSGIHasVMSGMember_DeallocatesDAIOfVMPort() throws Exception {\n // Arrange.\n SecurityGroup sg = new SecurityGroup(null, null, null);\n sg.addSecurityGroupMember(newSGMWithPort(VM.class, 1L));\n\n SecurityGroupInterface sgi = registerNewSGI(... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(AllocateDAIWithSGIMembersTask.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(AllocateDAIWithSGIMembersTask.class);",
"type": "Logger",
"var_name": ... | {
"body": "@Override\n public DeallocateDAIOfSGIMembersTask create(SecurityGroupInterface sgi, DistributedApplianceInstance dai) {\n DeallocateDAIOfSGIMembersTask task = new DeallocateDAIOfSGIMembersTask(sgi, dai);\n task.dbConnectionManager = this.dbConnectionManager;\n task.txBroadcastUtil =... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_197 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n\tpublic",
"original_string": "@Rule\n\tpublic ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "em... | {
"body": "@Test\n\tpublic void testExecute_WhenSDNReturnsNullNetworkElement_ThrowsUnhandledException() throws Exception {\n\t\t// Arrange.\n\t\tCreateServiceFunctionChainTask task = this.task.create(SECURITY_GROUP_SFC, this.portPairGroup);\n\t\tregisterNetworkElement(SECURITY_GROUP_SFC, null, new IllegalStateExcepti... | {
"fields": [
{
"declarator": "apiFactory",
"modifier": "@Reference\n\tprivate",
"original_string": "@Reference\n\tprivate ApiFactoryService apiFactory;",
"type": "ApiFactoryService",
"var_name": "apiFactory"
},
{
"declarator": "sfc",
"modifier": "private",
... | {
"body": "public CreateServiceFunctionChainTask create(SecurityGroup securityGroup, List<NetworkElement> portPairGroups) {\n\t\tCreateServiceFunctionChainTask task = new CreateServiceFunctionChainTask();\n\n\t\ttask.sfc = securityGroup.getServiceFunctionChain();\n\t\ttask.securityGroup = securityGroup;\n\t\ttask.por... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_178 | {
"fields": [
{
"declarator": "OPENSTACK_ID = \"openstack_id\"",
"modifier": "public static final",
"original_string": "public static final String OPENSTACK_ID = \"openstack_id\";",
"type": "String",
"var_name": "OPENSTACK_ID"
},
{
"declarator": "em",
"modifier": ... | {
"body": "@Test\n public void testExecute_WhenElementIdMatches_UpdateNotNeeded() throws Exception {\n // Arrange.\n SecurityGroup sg = registerSecurityGroup(1L, \"projectId\", \"projectName\", 1L, \"sgName\");\n sg.addSecurityGroupMember(newSGMWithPort(1L, OPENSTACK_ID));\n NetworkElem... | {
"fields": [
{
"declarator": "apiFactoryService",
"modifier": "@Reference\n private",
"original_string": "@Reference\n private ApiFactoryService apiFactoryService;",
"type": "ApiFactoryService",
"var_name": "apiFactoryService"
},
{
"declarator": "securityGroup",
... | {
"body": "public UpdatePortGroupTask create(SecurityGroup sg, NetworkElementImpl portGroup) {\n UpdatePortGroupTask task = new UpdatePortGroupTask();\n task.securityGroup = sg;\n task.portGroup = portGroup;\n task.apiFactoryService = this.apiFactoryService;\n task.dbConnectionManag... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_206 | {
"fields": [
{
"declarator": "em",
"modifier": "public",
"original_string": "public EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "txControl",
"modifier": "@Mock(answer = Answers.CALLS_REAL_METHODS)\n\tprivate",
"original_... | {
"body": "@Test\n\tpublic void testExecuteTransaction_WithVariousSecurityGroups_ExpectsCorrectTaskGraph() throws Exception {\n\t\t// Arrange.\n\t\tthis.task.createServiceFunctionChainTask = new CreateServiceFunctionChainTask();\n\t\tthis.task.updateServiceFunctionChainTask = new UpdateServiceFunctionChainTask();\n\t... | {
"fields": [
{
"declarator": "createServiceFunctionChainTask",
"modifier": "@Reference",
"original_string": "@Reference\n\tCreateServiceFunctionChainTask createServiceFunctionChainTask;",
"type": "CreateServiceFunctionChainTask",
"var_name": "createServiceFunctionChainTask"
},
... | {
"body": "public CheckServiceFunctionChainMetaTask create(SecurityGroup sg) {\n\t\tCheckServiceFunctionChainMetaTask task = new CheckServiceFunctionChainMetaTask();\n\n\t\ttask.createServiceFunctionChainTask = this.createServiceFunctionChainTask;\n\t\ttask.updateServiceFunctionChainTask = this.updateServiceFunctionC... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_49 | {
"fields": [
{
"declarator": "unEncryptedMessage = \"helloworld\"",
"modifier": "private",
"original_string": "private String unEncryptedMessage = \"helloworld\";",
"type": "String",
"var_name": "unEncryptedMessage"
},
{
"declarator": "aesCtrEncryptedMessage = \"af5b59... | {
"body": "@Test\n public void testEncryptAesCtr_WithValidMessage_ExpectsAesCtrHash() throws Exception {\n String encryption = new EncryptionUtil().encryptAESCTR(this.unEncryptedMessage);\n assertEquals(encryption.substring(32,33), \":\");\n assertEquals(encryption.length(), 53);\n }",
"c... | {
"fields": [
{
"declarator": "SECURITY_PROPS_RESOURCE_PATH = \"/org/osc/core/broker/util/crypto/security.properties\"",
"modifier": "public static final",
"original_string": "public static final String SECURITY_PROPS_RESOURCE_PATH = \"/org/osc/core/broker/util/crypto/security.properties\";",
... | {
"body": "@Override\n public String encryptAESCTR(String plainText) throws EncryptionException {\n return new AESCTREncryption().encrypt(plainText);\n }",
"class_method_signature": "EncryptionUtil.encryptAESCTR(String plainText)",
"constructor": false,
"full_signature": "@Override public String en... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_2 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator":... | {
"body": "@Test\n public void testGetDeploymentById_WhenK8sReturnsDeploymentWithMismatchingId_ReturnsNull() throws Exception {\n // Arrange.\n String name = UUID.randomUUID().toString();\n String namespace = UUID.randomUUID().toString();\n mockDeploymentByName(namespace, name, newDeplo... | {
"fields": [
{
"declarator": "OSC_DEPLOYMENT_LABEL_NAME = \"osc-deployment\"",
"modifier": "public final static",
"original_string": "public final static String OSC_DEPLOYMENT_LABEL_NAME = \"osc-deployment\";",
"type": "String",
"var_name": "OSC_DEPLOYMENT_LABEL_NAME"
},
{
... | {
"body": "public KubernetesDeployment getDeploymentById(String uid, String namespace, String name) throws VmidcException {\n if (uid == null) {\n throw new IllegalArgumentException(\"Uid should not be null\");\n }\n\n if (name == null) {\n throw new IllegalArgumentException... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_154 | {
"fields": [
{
"declarator": "factory",
"modifier": "@InjectMocks",
"original_string": "@InjectMocks\n DeleteInspectionPortTask factory;",
"type": "DeleteInspectionPortTask",
"var_name": "factory"
},
{
"declarator": "em",
"modifier": "@Mock\n protected",
... | {
"body": "@Test\n public void testExecute_WhenDomainNotFound_ThrowsValidationException() throws Exception {\n // Arrange.\n DistributedApplianceInstance dai = registerNewDAI(1L);\n\n registerDomain(null, dai);\n when(this.apiFactoryServiceMock.supportsPortGroup(dai.getVirtualSystem()))... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(DeleteInspectionPortTask.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(DeleteInspectionPortTask.class);",
"type": "Logger",
"var_name": "LOG"
... | {
"body": "public DeleteInspectionPortTask create(String region, DistributedApplianceInstance dai) {\n DeleteInspectionPortTask task = new DeleteInspectionPortTask();\n // TODO emanoel: This does not seem to be used anywhere, remove it on master.\n task.region = region;\n task.dai = dai;\n... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_32 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator":... | {
"body": "@Test\n public void testGetPodsbyLabel_WhenK8sReturnsPodWithMatchingId_ReturnsPod() throws Exception {\n // Arrange.\n String name = UUID.randomUUID().toString();\n String namespace = UUID.randomUUID().toString();\n String uid = UUID.randomUUID().toString();\n Pod pod ... | {
"fields": [],
"file": "osc-server/src/main/java/org/osc/core/broker/rest/client/k8s/KubernetesPodApi.java",
"identifier": "KubernetesPodApi",
"interfaces": "",
"methods": [
{
"class_method_signature": "KubernetesPodApi.KubernetesPodApi(KubernetesClient client)",
"constructor": true,
"f... | {
"body": "public KubernetesPod getPodById(String uid, String namespace, String name) throws VmidcException {\n if (uid == null) {\n throw new IllegalArgumentException(\"Uid should not be null\");\n }\n\n if (name == null) {\n throw new IllegalArgumentException(\"Name should... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_103 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator":... | {
"body": "@Test\n public void testConnection_WithOpenStack_WithIgnoreControllerException_WithIgnoreProviderException_WhenRabbitClientConnectionThrowsSignalException_WhenMqClientIsNotConnected_ThrowsErrorTypeException() throws Throwable {\n // Arrange.\n this.exception.expect(ErrorTypeException.class... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(VirtualizationConnectorUtil.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(VirtualizationConnectorUtil.class);",
"type": "Logger",
"var_name": "LOG... | {
"body": "public <T extends VirtualizationConnectorDto> void checkConnection(DryRunRequest<T> request, VirtualizationConnector vc) throws Exception {\n if (!request.isSkipAllDryRun()) {\n ErrorTypeException errorTypeException = null;\n final ArrayList<CertificateResolverModel> certifica... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_65 | {
"fields": [
{
"declarator": "USER = \"admin\"",
"modifier": "private static final",
"original_string": "private static final String USER = \"admin\";",
"type": "String",
"var_name": "USER"
},
{
"declarator": "PASSWORD = \"admin123\"",
"modifier": "private static... | {
"body": "@Test(expected = WebApplicationException.class)\n public void testInvalidCredentials() {\n //Base64 encoded string \"admin1:admin12345\"\n Mockito.when(this.mockRequest.getHeaderString(\"Authorization\")).thenReturn(\"Basic YWRtaW4xOmFkbWluMTIzNDU=\");\n this.authUtil.authenticate(t... | {
"fields": [
{
"declarator": "encrypter",
"modifier": "@Reference",
"original_string": "@Reference\n EncryptionApi encrypter;",
"type": "EncryptionApi",
"var_name": "encrypter"
},
{
"declarator": "logging",
"modifier": "@Reference",
"original_string": "@... | {
"body": "public void authenticate(ContainerRequestContext request, String validUserName, String validPass) {\n authenticate(request, ImmutableMap.of(validUserName, validPass));\n }",
"class_method_signature": "AuthUtil.authenticate(ContainerRequestContext request, String validUserName, String validPass)... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_115 | {
"fields": [
{
"declarator": "em",
"modifier": "public",
"original_string": "public EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "txControl",
"modifier": "@Mock(answer = Answers.CALLS_REAL_METHODS)\n private",
"origina... | {
"body": "@Test\n public void testExecuteTransaction_WithVariousDeploymentSpecs_ExpectsCorrectTaskGraph() throws Exception {\n // Arrange.\n this.factoryTask.deleteK8sDAIInspectionPortTask = new DeleteK8sDAIInspectionPortTask();\n this.factoryTask.registerK8sDAIInspectionPortTask = new Regist... | {
"fields": [
{
"declarator": "deleteK8sDAIInspectionPortTask",
"modifier": "@Reference",
"original_string": "@Reference\n DeleteK8sDAIInspectionPortTask deleteK8sDAIInspectionPortTask;",
"type": "DeleteK8sDAIInspectionPortTask",
"var_name": "deleteK8sDAIInspectionPortTask"
},... | {
"body": "public ConformK8sDeploymentSpecInspectionPortsMetaTask create(DeploymentSpec ds) {\n ConformK8sDeploymentSpecInspectionPortsMetaTask task = new ConformK8sDeploymentSpecInspectionPortsMetaTask();\n task.deleteK8sDAIInspectionPortTask = this.deleteK8sDAIInspectionPortTask;\n task.registe... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_73 | {
"fields": [
{
"declarator": "testFolder = new TemporaryFolder()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public TemporaryFolder testFolder = new TemporaryFolder();",
"type": "TemporaryFolder",
"var_name": "testFolder"
},
{
"declarator": "excep... | {
"body": "@Test\n public void testGetFileListFromDirectory_WithAvailablePath_ReturnsList() throws IOException {\n // Arrange.\n cleanRegularFile();\n populateTemporaryFolder();\n\n // Act.\n File[] fileList = FileUtil.getFileListFromDirectory(this.homeDirectory.getAbsolutePath()... | {
"fields": [],
"file": "osc-server/src/main/java/org/osc/core/broker/util/FileUtil.java",
"identifier": "FileUtil",
"interfaces": "",
"methods": [
{
"class_method_signature": "FileUtil.getFileListFromDirectory(String directory)",
"constructor": false,
"full_signature": "public static Fi... | {
"body": "public static File[] getFileListFromDirectory(String directory) throws FileNotFoundException {\n\n if (directory == null) {\n throw new FileNotFoundException(\"Cannot obtain list of files from directory - null given\");\n }\n\n File fileDir = new File(directory);\n if... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_142 | {
"fields": [
{
"declarator": "em",
"modifier": "private",
"original_string": "private EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "txControl",
"modifier": "@Mock(answer = Answers.CALLS_REAL_METHODS)\n private",
"origi... | {
"body": "@Test\n public void testExecute_WithVariousSGM_ExpectMarkedInTheEnd() throws Exception {\n // Arrange.\n MarkSecurityGroupInterfaceDeleteTask task = this.factoryTask.create(this.sgi);\n\n // Act.\n task.execute();\n\n // Assert.\n SecurityGroupInterface sgi = th... | {
"fields": [
{
"declarator": "sgi",
"modifier": "private",
"original_string": "private SecurityGroupInterface sgi;",
"type": "SecurityGroupInterface",
"var_name": "sgi"
}
],
"file": "osc-server/src/main/java/org/osc/core/broker/service/tasks/conformance/securitygroupinterfac... | {
"body": "public MarkSecurityGroupInterfaceDeleteTask create(SecurityGroupInterface sgi) {\n MarkSecurityGroupInterfaceDeleteTask task = new MarkSecurityGroupInterfaceDeleteTask();\n task.sgi = sgi;\n task.dbConnectionManager = this.dbConnectionManager;\n task.txBroadcastUtil = this.txBro... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_24 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator":... | {
"body": "@Test\n public void testGetPodsbyLabel_WhenK8sReturnsNull_ReturnsEmptyList() throws Exception {\n // Arrange.\n String label = UUID.randomUUID().toString();\n mockPodsByLabel(label, null);\n\n // Act.\n List<KubernetesPod> result = this.service.getPodsByLabel(label);\n... | {
"fields": [],
"file": "osc-server/src/main/java/org/osc/core/broker/rest/client/k8s/KubernetesPodApi.java",
"identifier": "KubernetesPodApi",
"interfaces": "",
"methods": [
{
"class_method_signature": "KubernetesPodApi.KubernetesPodApi(KubernetesClient client)",
"constructor": true,
"f... | {
"body": "public List<KubernetesPod> getPodsByLabel(String label) throws VmidcException {\n List<KubernetesPod> resultPodList = new ArrayList<KubernetesPod>();\n\n if (label == null) {\n throw new IllegalArgumentException(\"Label should not be null\");\n }\n\n try {\n ... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_53 | {
"fields": [
{
"declarator": "unEncryptedMessage = \"helloworld\"",
"modifier": "private",
"original_string": "private String unEncryptedMessage = \"helloworld\";",
"type": "String",
"var_name": "unEncryptedMessage"
},
{
"declarator": "aesCtrEncryptedMessage = \"af5b59... | {
"body": "@Test\n public void testDecryptAesCtr_WithNullMessage_ExpectsNull() throws EncryptionException {\n String decryption = new EncryptionUtil().decryptAESCTR(null);\n assertEquals(null, decryption);\n }",
"class_method_signature": "EncryptionUtilTest.testDecryptAesCtr_WithNullMessage_Expe... | {
"fields": [
{
"declarator": "SECURITY_PROPS_RESOURCE_PATH = \"/org/osc/core/broker/util/crypto/security.properties\"",
"modifier": "public static final",
"original_string": "public static final String SECURITY_PROPS_RESOURCE_PATH = \"/org/osc/core/broker/util/crypto/security.properties\";",
... | {
"body": "@Override\n public String decryptAESCTR(String cipherText) throws EncryptionException {\n return new AESCTREncryption().decrypt(cipherText);\n }",
"class_method_signature": "EncryptionUtil.decryptAESCTR(String cipherText)",
"constructor": false,
"full_signature": "@Override public String... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_135 | {
"fields": [
{
"declarator": "em",
"modifier": "public",
"original_string": "public EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "sgm",
"modifier": "private",
"original_string": "private SecurityGroupMember sgm;",
"... | {
"body": "@Test\n public void testExecute_WithVariousSGM_ExpectCorrectTaskGraph() throws Exception {\n // Arrange.\n UpdateK8sSecurityGroupMemberLabelMetaTask task = this.factoryTask.create(this.sgm, this.k8sPodApi);\n task.labelPodCreateTask = new CreateK8sLabelPodTask();\n task.label... | {
"fields": [
{
"declarator": "sgm",
"modifier": "private",
"original_string": "private SecurityGroupMember sgm;",
"type": "SecurityGroupMember",
"var_name": "sgm"
},
{
"declarator": "labelPodCreateTask",
"modifier": "@Reference",
"original_string": "@Refere... | {
"body": "UpdateK8sSecurityGroupMemberLabelMetaTask create(SecurityGroupMember sgm, KubernetesPodApi k8sPodApi) {\n UpdateK8sSecurityGroupMemberLabelMetaTask task = new UpdateK8sSecurityGroupMemberLabelMetaTask();\n task.sgm = sgm;\n task.labelPodCreateTask = this.labelPodCreateTask;\n ta... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_162 | {
"fields": [
{
"declarator": "em",
"modifier": "@Mock\n protected",
"original_string": "@Mock\n protected EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "tx",
"modifier": "@Mock\n protected",
"original_string": "@M... | {
"body": "@Test\n public void testExecute_WhenLabelHasExclusivePod_PodAndPodPortAreDeleted()\n throws Exception {\n // Arrange.\n Label label = new Label(\"labelName\", \"labelValue\");\n Pod pod = new Pod(\"name\", \"namespace\", \"node\", \"externalId\");\n pod.setId(101L)... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(SecurityGroupMemberDeleteTask.class)",
"modifier": "private final",
"original_string": "private final Logger log = LoggerFactory.getLogger(SecurityGroupMemberDeleteTask.class);",
"type": "Logger",
"var_name": "log"
},
... | {
"body": "public SecurityGroupMemberDeleteTask create(SecurityGroupMember sgm) {\n SecurityGroupMemberDeleteTask task = new SecurityGroupMemberDeleteTask();\n task.sgm = sgm;\n task.dbConnectionManager = this.dbConnectionManager;\n task.txBroadcastUtil = this.txBroadcastUtil;\n\n r... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_12 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator":... | {
"body": "@Test\n public void testUpdateDeploymentReplicaCount_WhenK8sReturnsDeploymentWithMatchingId_DeploymentUpdated() throws Exception {\n // Arrange.\n String name = UUID.randomUUID().toString();\n String namespace = UUID.randomUUID().toString();\n String uid = UUID.randomUUID().t... | {
"fields": [
{
"declarator": "OSC_DEPLOYMENT_LABEL_NAME = \"osc-deployment\"",
"modifier": "public final static",
"original_string": "public final static String OSC_DEPLOYMENT_LABEL_NAME = \"osc-deployment\";",
"type": "String",
"var_name": "OSC_DEPLOYMENT_LABEL_NAME"
},
{
... | {
"body": "public void updateDeploymentReplicaCount(String uid, String namespace, String name, int replicaCount) throws VmidcException {\n if (uid == null) {\n throw new IllegalArgumentException(\"The uid should not be null\");\n }\n\n if (name == null) {\n throw new Illegal... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_174 | {
"fields": [
{
"declarator": "factory",
"modifier": "@InjectMocks",
"original_string": "@InjectMocks\n RemovePortGroupHookTask factory;",
"type": "RemovePortGroupHookTask",
"var_name": "factory"
},
{
"declarator": "em",
"modifier": "@Mock\n protected",
... | {
"body": "@Test\n public void testExecute_WhenCreateNetworkRedirectionApiFails_ThrowsTheUnhandledException() throws Exception {\n // Arrange.\n SecurityGroupInterface sgi = registerNewSGI(2L);\n\n when(this.apiFactoryServiceMock.createNetworkRedirectionApi(sgi.getVirtualSystem()))\n ... | {
"fields": [
{
"declarator": "sgi",
"modifier": "public",
"original_string": "public SecurityGroupInterface sgi;",
"type": "SecurityGroupInterface",
"var_name": "sgi"
},
{
"declarator": "LOG = LoggerFactory.getLogger(RemovePortGroupHookTask.class)",
"modifier": "... | {
"body": "public RemovePortGroupHookTask create(SecurityGroupInterface sgi){\n RemovePortGroupHookTask task = new RemovePortGroupHookTask();\n task.sgi = sgi;\n task.apiFactoryService = this.apiFactoryService;\n task.dbConnectionManager = this.dbConnectionManager;\n task.txBroadcas... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_45 | {
"fields": [
{
"declarator": "FILE_TEXT = \"Some file input.\"",
"modifier": "private final static",
"original_string": "private final static String FILE_TEXT = \"Some file input.\";",
"type": "String",
"var_name": "FILE_TEXT"
},
{
"declarator": "DIR_PATH = System.getP... | {
"body": "@Test\n public void writeBytesToFile_fileNotExistsAndPathTraversalInFileName_expectedFail() throws IOException {\n //Arrange.\n Path file = Paths.get(DIR_PATH + File.separator + FILE_NAME_WITH_TRAVERSAL);\n Path backup = Paths.get(DIR_PATH + File.separator + FILE_NAME_WITH_TRAVERSAL... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(PKIUtil.class)",
"modifier": "private static final",
"original_string": "private static final Logger log = LoggerFactory.getLogger(PKIUtil.class);",
"type": "Logger",
"var_name": "log"
},
{
"declarator": "keyA... | {
"body": "public static void writeBytesToFile(byte[] bytes, String parentFolderName, String fileName) {\n\n StringBuilder sb = new StringBuilder(parentFolderName)\n .append(File.separator)\n .append(fileName);\n\n Path file = Paths.get(sb.toString());\n Path backup ... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_123 | {
"fields": [
{
"declarator": "em",
"modifier": "@Mock\n protected",
"original_string": "@Mock\n protected EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "tx",
"modifier": "@Mock\n protected",
"original_string": "@M... | {
"body": "@Test\n public void testExecute_WhenSDNReturnsNullNetworkElement_ThrowsVmidcException() throws Exception {\n // Arrange.\n KubernetesPod k8sPod = createKubernetesPod();\n DeploymentSpec ds = createAndRegisterDeploymentSpec(null);\n\n registerNetworkElement(ds, null, k8sPod);\... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(CreateOrUpdateK8sDAITask.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(CreateOrUpdateK8sDAITask.class);",
"type": "Logger",
"var_name": "LOG"
... | {
"body": "public CreateOrUpdateK8sDAITask create(DeploymentSpec ds, KubernetesPod k8sPod) {\n return create(ds, k8sPod, null);\n }",
"class_method_signature": "CreateOrUpdateK8sDAITask.create(DeploymentSpec ds, KubernetesPod k8sPod)",
"constructor": false,
"full_signature": "public CreateOrUpdateK8sD... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_158 | {
"fields": [
{
"declarator": "em",
"modifier": "@Mock\n protected",
"original_string": "@Mock\n protected EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "tx",
"modifier": "@Mock\n protected",
"original_string": "@M... | {
"body": "@Test\n public void testExecute_SGWithMultipleSGM_ExecutionFinishes() throws Exception {\n // Arrange.\n SecurityGroup sg = registerSecurityGroup(1L, \"projectId\", \"projectName\", 1L, \"sgName\");\n sg.addSecurityGroupMember(newSGMWithPort(1L));\n sg.addSecurityGroupMember(... | {
"fields": [
{
"declarator": "apiFactoryService",
"modifier": "@Reference\n private",
"original_string": "@Reference\n private ApiFactoryService apiFactoryService;",
"type": "ApiFactoryService",
"var_name": "apiFactoryService"
},
{
"declarator": "securityGroup",
... | {
"body": "public CreatePortGroupTask create(SecurityGroup sg) {\n CreatePortGroupTask task = new CreatePortGroupTask();\n task.securityGroup = sg;\n task.apiFactoryService = this.apiFactoryService;\n task.dbConnectionManager = this.dbConnectionManager;\n task.txBroadcastUtil = this... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_86 | {
"fields": [
{
"declarator": "oldProcessId = \"10000\"",
"modifier": "private final",
"original_string": "private final String oldProcessId = \"10000\";",
"type": "String",
"var_name": "oldProcessId"
},
{
"declarator": "linuxProcessExec = \"ps \"",
"modifier": "p... | {
"body": "@Test\n public void testReadPIDFromFile_WithOverflowedPID_ThrowsCorruptedPidException() throws IOException, CorruptedPidException {\n // Arrange.\n Files.write(this.regularFile.toPath(), String.valueOf(Integer.MAX_VALUE).getBytes(), StandardOpenOption.APPEND);\n this.exception.expec... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(ServerUtil.class)",
"modifier": "private static final",
"original_string": "private static final Logger log = LoggerFactory.getLogger(ServerUtil.class);",
"type": "Logger",
"var_name": "log"
},
{
"declarator":... | {
"body": "static Integer readPIDFromFile(String filename) throws CorruptedPidException {\n if (!new File(filename).exists()) {\n return null;\n }\n\n String PID = null;\n try (BufferedReader in = new BufferedReader(new FileReader(filename))){\n PID = in.readLine();\n... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_69 | {
"fields": [
{
"declarator": "USER = \"admin\"",
"modifier": "private static final",
"original_string": "private static final String USER = \"admin\";",
"type": "String",
"var_name": "USER"
},
{
"declarator": "PASSWORD = \"admin123\"",
"modifier": "private static... | {
"body": "@Test\n public void validAuthenticateLocalRequestByIp() throws URISyntaxException {\n Mockito.when(this.uriInfo.getRequestUri()).thenReturn(new URI(\"http://127.0.0.1\"));\n Mockito.when(this.mockRequest.getUriInfo()).thenReturn(this.uriInfo);\n this.authUtil.authenticateLocalReques... | {
"fields": [
{
"declarator": "encrypter",
"modifier": "@Reference",
"original_string": "@Reference\n EncryptionApi encrypter;",
"type": "EncryptionApi",
"var_name": "encrypter"
},
{
"declarator": "logging",
"modifier": "@Reference",
"original_string": "@... | {
"body": "public void authenticateLocalRequest(ContainerRequestContext request) {\n WebApplicationException wae = new WebApplicationException(\n Response.status(Response.Status.UNAUTHORIZED).entity(\"not authorized\").build());\n if(request.getUriInfo()!=null && request.getUriInfo().getR... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_226 | {
"fields": [
{
"declarator": "em",
"modifier": "@Mock\n private",
"original_string": "@Mock\n private EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "txBroadcastUtil",
"modifier": "@Mock\n private",
"original_strin... | {
"body": "@Test\n public void testValidateForCreate_WithValidNewUser_ValidationSucceeds() throws Exception {\n // Act.\n this.validator.validateForCreate(this.newUserDto);\n }",
"class_method_signature": "UserDtoValidatorTest.testValidateForCreate_WithValidNewUser_ValidationSucceeds()",
"cons... | {
"fields": [
{
"declarator": "em",
"modifier": "",
"original_string": "EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "txBroadcastUtil",
"modifier": "private",
"original_string": "private TransactionalBroadcastUtil txBroadc... | {
"body": "@Override\n public void validateForCreate(UserDto dto) throws Exception {\n validate(dto);\n\n OSCEntityManager<User> emgr = new OSCEntityManager<User>(User.class, this.em, this.txBroadcastUtil);\n\n if (emgr.isExisting(\"loginName\", dto.getLoginName())) {\n throw new Vm... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_90 | {
"fields": [
{
"declarator": "oldProcessId = \"10000\"",
"modifier": "private final",
"original_string": "private final String oldProcessId = \"10000\";",
"type": "String",
"var_name": "oldProcessId"
},
{
"declarator": "linuxProcessExec = \"ps \"",
"modifier": "p... | {
"body": "@Test\n public void testDeletePidFileIfOwned_WithDifferentCurrentPid_PreservesPIDFile() throws IOException {\n // Arrange.\n mockGetCurrentPid(\"1100\");\n Files.write(this.regularFile.toPath(), \"1000\".getBytes(), StandardOpenOption.APPEND);\n Assert.assertTrue(this.regular... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(ServerUtil.class)",
"modifier": "private static final",
"original_string": "private static final Logger log = LoggerFactory.getLogger(ServerUtil.class);",
"type": "Logger",
"var_name": "log"
},
{
"declarator":... | {
"body": "public static void deletePidFileIfOwned(String filename) {\n Integer filePid;\n\n try {\n filePid = readPIDFromFile(filename);\n } catch (CorruptedPidException e) {\n log.error(\"PID number is corrupted\", e);\n return;\n }\n\n if (filePid... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_119 | {
"fields": [
{
"declarator": "em",
"modifier": "public",
"original_string": "public EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "txControl",
"modifier": "@Mock(answer = Answers.CALLS_REAL_METHODS)\n private",
"origina... | {
"body": "@Test\n public void testExecuteTransaction_WithVariousDeploymentSpecs_ExpectsCorrectTaskGraph() throws Exception {\n // Arrange.\n this.factoryTask.deleteDSFromDbTask = new DeleteDSFromDbTask();\n this.factoryTask.mgrCheckDevicesMetaTask = new MgrCheckDevicesMetaTask();\n thi... | {
"fields": [
{
"declarator": "deleteK8sDeploymentTask",
"modifier": "@Reference",
"original_string": "@Reference\n DeleteK8sDeploymentTask deleteK8sDeploymentTask;",
"type": "DeleteK8sDeploymentTask",
"var_name": "deleteK8sDeploymentTask"
},
{
"declarator": "createO... | {
"body": "public ConformK8sDeploymentSpecMetaTask create(DeploymentSpec ds) {\n ConformK8sDeploymentSpecMetaTask task = new ConformK8sDeploymentSpecMetaTask();\n task.deleteK8sDAIInspectionPortTask = this.deleteK8sDAIInspectionPortTask;\n task.deleteK8sDeploymentTask = this.deleteK8sDeploymentTa... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_230 | {
"fields": [],
"file": "osc-server/src/test/java/org/osc/core/broker/service/validator/VirtualizationConnectorDtoValidatorTest.java",
"identifier": "VirtualizationConnectorDtoValidatorTest",
"interfaces": "",
"superclass": "extends VirtualizationConnectorDtoValidatorBaseTest"
} | {
"body": "@Test\n public void testValidateForCreate_WhenVcRequest_ReturnsSuccessful() throws Exception {\n // Act.\n this.dtoValidator.validateForCreate(VirtualizationConnectorDtoValidatorTestData.OPENSTACK_NOCONTROLLER_VC);\n\n //Assert\n Assert.assertTrue(true);\n }",
"class_met... | {
"fields": [
{
"declarator": "em",
"modifier": "private",
"original_string": "private EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "txBroadcastUtil",
"modifier": "private",
"original_string": "private TransactionalBroadca... | {
"body": "@Override\n public void validateForCreate(VirtualizationConnectorDto dto) throws Exception {\n // Initializing Entity Manager\n OSCEntityManager<VirtualizationConnector> emgr = new OSCEntityManager<>(\n VirtualizationConnector.class, this.em, this.txBroadcastUtil);\n\n ... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
80228150_28 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator":... | {
"body": "@Test\n public void testGetPodsbyId_WithNullNameSpace_ThrowsIllegalArgumentException() throws Exception {\n // Arrange.\n this.exception.expect(IllegalArgumentException.class);\n\n // Act.\n this.service.getPodById(\"1234\", \"sample_name\", null);\n }",
"class_method_si... | {
"fields": [],
"file": "osc-server/src/main/java/org/osc/core/broker/rest/client/k8s/KubernetesPodApi.java",
"identifier": "KubernetesPodApi",
"interfaces": "",
"methods": [
{
"class_method_signature": "KubernetesPodApi.KubernetesPodApi(KubernetesClient client)",
"constructor": true,
"f... | {
"body": "public KubernetesPod getPodById(String uid, String namespace, String name) throws VmidcException {\n if (uid == null) {\n throw new IllegalArgumentException(\"Uid should not be null\");\n }\n\n if (name == null) {\n throw new IllegalArgumentException(\"Name should... | {
"created": null,
"fork": null,
"fork_count": 25,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 80228150,
"size": 202237,
"stargazer_count": 36,
"stars": null,
"updates": null,
"url": "https://github.com/opensecuritycontroller/osc-core"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.