id stringlengths 7 14 | test_class dict | test_case dict | focal_class dict | focal_method dict | repository dict |
|---|---|---|---|---|---|
80228150_29 | {
"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 testGetPodById_WhenK8ClientThrowsKubernetesClientException_ThrowsVmidcException() throws Exception {\n // Arrange.\n this.exception.expect(VmidcException.class);\n when(this.fabric8Client.pods()).thenThrow(new KubernetesClientException(\"\"));\n\n // Act.\... | {
"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_231 | {
"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_WhenVcNameExistsRequest_ThrowsValidationException() throws Exception {\n // Arrange.\n this.exception.expect(VmidcBrokerValidationException.class);\n VirtualizationConnectorDto dto = VirtualizationConnectorDtoValidatorTestData.OPENSTACK_NAME... | {
"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_91 | {
"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_WithSkipDryRunRequest_ReturnsSuccessful() throws Exception {\n // Arrange.\n DryRunRequest<VirtualizationConnectorRequest> request = VirtualizationConnectorUtilTestData.generateOpenStackVCWithSDN();\n request.setSkipAllDryRun(true);\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_118 | {
"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_WhenInspectionPortIsRemoved_DAIIsDeleted() throws Exception {\n // Arrange.\n DistributedApplianceInstance dai = createAndRegisterDAI();\n DeleteK8sDAIInspectionPortTask task = this.factory.create(dai);\n when(this.apiFactoryServiceMock.createN... | {
"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_227 | {
"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_WithValidExistingUser_ReturnsExistingUser() throws Exception {\n // Arrange.\n User response = null;\n\n // Act.\n response = this.validator.validateForUpdate(this.existingUserDto);\n\n // Assert.\n Assert.assertNotNull(... | {
"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_87 | {
"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_WithCorruptedPID_ThrowsCorruptedPidException() throws IOException, CorruptedPidException {\n // Arrange.\n Files.write(this.regularFile.toPath(), \"notnumber\".getBytes(), StandardOpenOption.APPEND);\n this.exception.expect(CorruptedPidExcepti... | {
"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_68 | {
"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 validAuthenticate() {\n Mockito.when(this.mockRequest.getHeaderString(\"Authorization\")).thenReturn(\"Basic YWRtaW46YWRtaW4xMjM=\");\n this.authUtil.authenticate(this.mockRequest, USER, ENCRYPTED_PASSWORD);\n }",
"class_method_signature": "AuthUtilTest.validAuthen... | {
"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_159 | {
"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_WhenPortGroupIsNotFound_ThrowsException() throws Exception {\n // Arrange.\n SecurityGroup sg = registerSecurityGroup(1L, \"projectId\", \"projectName\", 1L, \"sgName\");\n sg.addSecurityGroupMember(newSGMWithPort(1L));\n\n ostRegisterPorts(sg)... | {
"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_44 | {
"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 writeInputStreamToFile_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_TRA... | {
"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 writeInputStreamToFile(InputStream is, 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... | {
"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_122 | {
"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_OrphanDAI_DAICreatedWithInspectionElementId() throws Exception {\n // Arrange.\n KubernetesPod k8sPod = createKubernetesPod();\n NetworkElement podPort = createNetworkElement();\n DistributedApplianceInstance dai = ... | {
"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_13 | {
"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 testCreateDeployment_WithNullDeployment_ThrowsVmidcException() throws Exception {\n // Arrange.\n this.exception.expect(IllegalArgumentException.class);\n\n // Act.\n this.deploymentApi.createDeployment(null);\n }",
"class_method_signature": "Kubernet... | {
"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 String createDeployment(KubernetesDeployment deployment) throws VmidcException {\n if (deployment == null) {\n throw new IllegalArgumentException(\"The deployment should not be null\");\n }\n\n try {\n Deployment newDeployment = new DeploymentBuilder()\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_175 | {
"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_WhenRemoveInspectionHookFails_ThrowsTheUnhandledException() throws Exception {\n // Arrange.\n SecurityGroupInterface sgi = registerNewSGI(3L);\n\n SdnRedirectionApi redirectionApi = mockRemoveInspectionHook(sgi, new IllegalStateException());\n\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_163 | {
"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_WhenPodPortHasAssignedDAI_ProtectedPodPortIsUnassignedFromDAI()\n throws Exception {\n // Arrange.\n Label label = new Label(\"labelName\", \"labelValue\");\n Pod pod = new Pod(\"name\", \"namespace\", \"node\", \"e... | {
"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_52 | {
"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_WithValidMessage_ExpectsDecryptedMessage() throws EncryptionException {\n String decryption = new EncryptionUtil().decryptAESCTR(this.aesCtrEncryptedMessage);\n assertEquals(this.unEncryptedMessage, decryption);\n }",
"class_method_signature": "En... | {
"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_134 | {
"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_WithPodAssignedToTargetedMember_PodAndPortRemoved() throws Exception {\n // Arrange.\n Pod pod = createAndRegisterPod(100L);\n String sameLabel = UUID.randomUUID().toString();\n pod.getLabels().add(new Label(UUID.randomUUID().toString(), sameLa... | {
"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 DeleteK8sLabelPodTask create(Pod pod, Label label) {\n DeleteK8sLabelPodTask task = new DeleteK8sLabelPodTask();\n task.pod = pod;\n task.label = label;\n task.dbConnectionManager = this.dbConnectionManager;\n task.txBroadcastUtil = this.txBroadcastUtil;\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_143 | {
"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 MarkSecurityGroupMemberDeleteTask task = this.factoryTask.create(this.sgm);\n\n // Act.\n task.execute();\n\n // Assert.\n SecurityGroupMember sgm = this.txC... | {
"fields": [
{
"declarator": "sgm",
"modifier": "private",
"original_string": "private SecurityGroupMember sgm;",
"type": "SecurityGroupMember",
"var_name": "sgm"
}
],
"file": "osc-server/src/main/java/org/osc/core/broker/service/tasks/conformance/securitygroup/MarkSecurityG... | {
"body": "public MarkSecurityGroupMemberDeleteTask create(SecurityGroupMember sgm) {\n MarkSecurityGroupMemberDeleteTask task = new MarkSecurityGroupMemberDeleteTask();\n task.sgm = sgm;\n task.dbConnectionManager = this.dbConnectionManager;\n task.txBroadcastUtil = this.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_25 | {
"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_WhenK8sReturnsEmptyList_ReturnsEmptyList() throws Exception {\n // Arrange.\n String label = UUID.randomUUID().toString();\n mockPodsByLabel(label, new ArrayList<Pod>());\n\n // Act.\n List<KubernetesPod> result = this.service.get... | {
"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_114 | {
"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_WithDAIAssignedToInspectionElement_DAICleanedOfNetworkInformation() throws Exception {\n // Arrange.\n DistributedApplianceInstance dai = createAndRegisterDAI(true, 100L);\n\n CleanK8sDAITask task = this.factory.create(dai);\n\n // Act.\n ... | {
"fields": [
{
"declarator": "dai",
"modifier": "private",
"original_string": "private DistributedApplianceInstance dai;",
"type": "DistributedApplianceInstance",
"var_name": "dai"
}
],
"file": "osc-server/src/main/java/org/osc/core/broker/service/tasks/conformance/k8s/deplo... | {
"body": "public CleanK8sDAITask create(DistributedApplianceInstance daiForDeletion) {\n return create(daiForDeletion, null);\n }",
"class_method_signature": "CleanK8sDAITask.create(DistributedApplianceInstance daiForDeletion)",
"constructor": false,
"full_signature": "public CleanK8sDAITask create(D... | {
"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_72 | {
"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_WithNullPath_ThrowsFileNotFound() throws FileNotFoundException {\n // Arrange.\n this.exception.expect(FileNotFoundException.class);\n this.exception.expectMessage(\"Cannot obtain list of files from directory - null given\");\n\n ... | {
"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_102 | {
"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_ThrowsErrorTypeException() throws Throwable {\n // Arrange.\n this.exception.expect(ErrorTypeException.class);\n\n DryRunRequest... | {
"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_64 | {
"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 testAuthenticateInvalidTokensBasic() {\n Mockito.when(this.mockRequest.getHeaderString(\"Authorization\")).thenReturn(\"BASIC1\\\\+s\");\n this.authUtil.authenticate(this.mockRequest, USER, ENCRYPTED_PASSWORD);\n }",
"class... | {
"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_155 | {
"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_WhenRemoveInspectionPortFails_ThrowsTheUnhandledException() throws Exception {\n // Arrange.\n DistributedApplianceInstance dai = registerNewDAI(1L);\n String domainId = UUID.randomUUID().toString();\n\n registerDomain(domainId, dai);\n\n ... | {
"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_33 | {
"fields": [
{
"declarator": "validDaNames = Lists.newArrayList(\"arv-1\",\"arv-56789-123\")",
"modifier": "private static final",
"original_string": "private static final List<String> validDaNames = Lists.newArrayList(\"arv-1\",\"arv-56789-123\");",
"type": "List<String>",
"var_nam... | {
"body": "@Test\n public void testCheckForNullFields() {\n HashMap<String, Object> map = new HashMap<>();\n map.put(\"foo\", new Object());\n map.put(\"foo1\", new Object());\n map.put(\"foo2\", new Object());\n map.put(\"foo3\", new Object());\n\n try {\n Vali... | {
"fields": [
{
"declarator": "DEFAULT_MAX_LEN = 155",
"modifier": "public static final",
"original_string": "public static final int DEFAULT_MAX_LEN = 155;",
"type": "int",
"var_name": "DEFAULT_MAX_LEN"
}
],
"file": "osc-server/src/main/java/org/osc/core/broker/util/Validate... | {
"body": "public static void checkForNullFields(Map<String, Object> map) throws VmidcBrokerInvalidEntryException {\n\n // Map will contain a map of (fieldName, fieldValue) pairs to be checked\n // for null/empty values\n\n for (Entry<String, Object> entry : map.entrySet()) {\n\n Strin... | {
"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_3 | {
"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_WhenK8sReturnsDeploymentWithMatchingId_ReturnsDeployment() throws Exception {\n // Arrange.\n String name = UUID.randomUUID().toString();\n String namespace = UUID.randomUUID().toString();\n String uid = UUID.randomUUID().toString();\... | {
"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_48 | {
"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_WithNullMessage_ExpectsNull() throws EncryptionException {\n String encryption = EncryptionUtil.encryptPbkdf2(null);\n assertEquals(null, encryption);\n }",
"class_method_signature": "EncryptionUtilTest.testEncryptPbkdf2_WithNullMessage_ExpectsNul... | {
"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_207 | {
"fields": [
{
"declarator": "VALID_ID = 1L",
"modifier": "private static final",
"original_string": "private static final Long VALID_ID = 1L;",
"type": "Long",
"var_name": "VALID_ID"
},
{
"declarator": "INVALID_ID = 2L",
"modifier": "private static final",
... | {
"body": "@Test\n public void testStartDeleteDAJob_WithoutUnlockObjectMetaTask_ExpectsSuccess() throws Exception {\n // Act\n this.deleteDistributedApplianceService.startDeleteDAJob(VALID_DA, null);\n\n // Assert\n PowerMockito.verifyStatic(Mockito.times(1));\n LockUtil.tryLockD... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(DeleteDistributedApplianceService.class)",
"modifier": "private static final",
"original_string": "private static final Logger log = LoggerFactory.getLogger(DeleteDistributedApplianceService.class);",
"type": "Logger",
"var... | {
"body": "Job startDeleteDAJob(final DistributedAppliance da, UnlockObjectMetaTask ult) throws Exception {\n\n try {\n if (ult == null) {\n ult = LockUtil.tryLockDA(da, da.getApplianceManagerConnector());\n }\n\n Job job;\n TaskGraph tg = new TaskGrap... | {
"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_196 | {
"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_WithSecurityGroupBoundToSFCAlreadyBound_ExpectUpdateSFCElementId() throws Exception {\n\t\t// Arrange.\n\t\tCreateServiceFunctionChainTask task = this.task.create(NEW_SECURITY_GROUP_SAME_SFC_BINDED_UPDATE_ELEMENT_ID,\n\t\t\t\tthis.portPairGroup);\n\n\t\t// Act.\n\t\ttask.ex... | {
"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_179 | {
"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_WhenElementIdMismatches_UpdateDone() throws Exception {\n // Arrange.\n SecurityGroup sg = registerSecurityGroup(1L, \"projectId\", \"projectName\", 1L, \"sgName\");\n sg.addSecurityGroupMember(newSGMWithPort(1L, OPENSTACK_ID));\n NetworkElemen... | {
"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_180 | {
"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_WhenPortGroupIsNotFound_ThrowsException() throws Exception {\n // Arrange.\n SecurityGroup sg = registerSecurityGroup(1L, \"projectId\", \"projectName\", 1L, \"sgName\");\n sg.addSecurityGroupMember(newSGMWithPort(1L, \"\"));\n NetworkElementIm... | {
"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_246 | {
"fields": [],
"file": "osc-installer/src/test/java/org/osc/core/server/installer/impl/RequirementParserTest.java",
"identifier": "RequirementParserTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n\tpublic void testParseRequireCapability() {\n\t\tList<Requirement> actual = RequirementParser.parseRequireCapability(\"osgi.extender; filter:=\\\"(&(osgi.extender=osgi.ds)(version>=1.0))\\\"; effective:=active, osgi.service; filter:=\\\"(objectClass=org.example.Foo)\\\"\");\n\t\t\n\t\tassertEquals(... | {
"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> parseRequireCapability(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> reqs = new ArrayList<>(clauses.length);\n\t\tfor (... | {
"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_138 | {
"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_WhenK8sPodAlreadyBelongsToAnotherSG_ThrowsVmidException() throws Exception {\n // Arrange.\n CreateK8sLabelPodTask task = this.factoryTask.create(ALREADY_PROTECTED_K8S_POD, ALREADY_PROTECTED_POD_SGM_LABEL);\n this.exception.expect(VmidcException.class... | {
"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_211 | {
"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\n public void testExecuteValidRequest() throws Exception {\n ServiceDispatcher<?, ?> mockServiceDispatcher = new ServiceDispatcher<Request, Response>() {\n\n {\n this.userContext = Mockito.mock(UserContextApi.class);\n }\n\n @Override\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_55 | {
"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 testEncryptAESGCM_withValidInputParameters_encryptionSucceeds() throws EncryptionException {\n // Arrange.\n // (in setUp() method)\n\n // Act.\n byte[] encrypted = new EncryptionUtil().encryptAESGCM(this.plainText, this.key, this.iv, this.aad);\n\n ... | {
"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 byte[] encryptAESGCM(byte[] plainText, SecretKey key, byte[] iv, byte[] aad) throws EncryptionException {\n return new AESGCMEncryption().encrypt(plainText, key, iv, aad);\n }",
"class_method_signature": "EncryptionUtil.encryptAESGCM(byte[] plainText, SecretKey key, byte[]... | {
"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_133 | {
"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_WithPodAssignedToAnotherMember_NothingIsRemoved() throws Exception {\n // Arrange.\n Pod pod = createAndRegisterPod(100L);\n pod.getLabels().add(new Label(UUID.randomUUID().toString(), UUID.randomUUID().toString()));\n\n Label memberLabel = new... | {
"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 DeleteK8sLabelPodTask create(Pod pod, Label label) {\n DeleteK8sLabelPodTask task = new DeleteK8sLabelPodTask();\n task.pod = pod;\n task.label = label;\n task.dbConnectionManager = this.dbConnectionManager;\n task.txBroadcastUtil = this.txBroadcastUtil;\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_164 | {
"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_WhenLabelHasSharedPod_PodAndPodPortAreNotDeleted()\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_14 | {
"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 testCreateDeployment_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 String createDeployment(KubernetesDeployment deployment) throws VmidcException {\n if (deployment == null) {\n throw new IllegalArgumentException(\"The deployment should not be null\");\n }\n\n try {\n Deployment newDeployment = new DeploymentBuilder()\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_172 | {
"fields": [
{
"declarator": "em",
"modifier": "@Mock\n public",
"original_string": "@Mock\n public EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "txControl",
"modifier": "@Mock(answer = Answers.CALLS_REAL_METHODS)\n pr... | {
"body": "@Test\n public void testExecuteTransaction_WithVariousSecurityGroupInterfaces_ExpectsValidTaskGraphOrException() throws Exception {\n // Arrange.\n this.factoryTask.allocateDai = new AllocateDAIWithSGIMembersTask();\n this.factoryTask.deallocateDai = new DeallocateDAIOfSGIMembersTas... | {
"fields": [
{
"declarator": "sgi",
"modifier": "private",
"original_string": "private SecurityGroupInterface sgi;",
"type": "SecurityGroupInterface",
"var_name": "sgi"
},
{
"declarator": "tg",
"modifier": "private",
"original_string": "private TaskGraph tg... | {
"body": "public CheckPortGroupHookMetaTask create(SecurityGroupInterface sgi, boolean isDeleteTg) {\n CheckPortGroupHookMetaTask task = new CheckPortGroupHookMetaTask();\n task.sgi = sgi;\n task.isDeleteTaskGraph = isDeleteTg;\n task.allocateDai = this.allocateDai;\n task.dealloca... | {
"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_43 | {
"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 writeInputStreamToFile_fileNotExists_expectedFailOnMoveFileToBackup() throws IOException {\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 W... | {
"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 writeInputStreamToFile(InputStream is, 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... | {
"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_125 | {
"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_WithExistingDS_K8sDSIsDeleted() throws Exception {\n // Arrange.\n VirtualizationConnector vc = new VirtualizationConnector();\n vc.setProviderIpAddress(\"1.1.1.1\");\n VirtualSystem vs = new VirtualSystem(null);\n vs.setVirtualizationCo... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(DeleteK8sDeploymentTask.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(DeleteK8sDeploymentTask.class);",
"type": "Logger",
"var_name": "LOG"
},... | {
"body": "public DeleteK8sDeploymentTask create(DeploymentSpec ds) {\n return create(ds, null);\n }",
"class_method_signature": "DeleteK8sDeploymentTask.create(DeploymentSpec ds)",
"constructor": false,
"full_signature": "public DeleteK8sDeploymentTask create(DeploymentSpec ds)",
"identifier": "cre... | {
"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_38 | {
"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_expectedSuccess() {\n //Arrange.\n Path file = Paths.get(DIR_PATH + File.separator + FILE_NAME);\n Path backup = Paths.get(DIR_PATH + File.separator + FILE_NAME + \".org\");\n Writer logs = getLogs();\n //Act.\n ... | {
"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_8 | {
"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_WhenK8ClientThrowsKubernetesClientException_ThrowsVmidcException() throws Exception {\n // Arrange.\n this.exception.expect(VmidcException.class);\n when(this.extensionsApiMock.deployments()).thenThrow(new KubernetesClientExceptio... | {
"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_80 | {
"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 @SuppressWarnings(\"unchecked\")\n public void testKillProcess_WithShortRunningProcessId_UsesGentleShutdown() throws Exception {\n // Arrange.\n final boolean[] testPassed = new boolean[1];\n final List<String> gentleShutdownIterationsCounter = new ArrayList<>();\n\n ... | {
"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 void killProcess(String oldPid) throws InterruptedException {\n // Making sure that old process also went away.\n int retries = 10; // 10 x 500ms = 5 seconds.\n boolean pidFound = false;\n while (retries > 0) {\n List<String> lines = new ArrayList<>();\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_109 | {
"fields": [
{
"declarator": "em",
"modifier": "@Mock\n\tprivate",
"original_string": "@Mock\n\tprivate EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "keyStoreProviderMock",
"modifier": "@Mock\n\tprivate",
"original_string... | {
"body": "@Test\n public void testIsValidZipBackupFilename_withValidFilename_succeeds() {\n\t\t// Arrange.\n\t\tString givenFilename = \"/example/filename.zip\";\n\t\t// Act.\n boolean result = this.target.isValidZipBackupFilename(givenFilename);\n\t\t// Assert.\n assertTrue(result);\n }",
"cla... | {
"fields": [
{
"declarator": "DEFAULT_BACKUP_FILE_NAME = \"BrokerServerDBBackup\"",
"modifier": "protected static final",
"original_string": "protected static final String DEFAULT_BACKUP_FILE_NAME = \"BrokerServerDBBackup\";",
"type": "String",
"var_name": "DEFAULT_BACKUP_FILE_NAME"... | {
"body": "@Override\n public boolean isValidZipBackupFilename(String filename) {\n \treturn (\".\" + FilenameUtils.getExtension(filename)).equals(EXT_ZIP_BACKUP);\n }",
"class_method_signature": "BackupFileService.isValidZipBackupFilename(String filename)",
"constructor": false,
"full_signature": "@Ov... | {
"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_220 | {
"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_UsingExistingImageUrl_ThrowsVmidcBrokerValidationException() throws Exception {\n // Arrange.\n ApplianceSoftwareVersionDto dto = newApplianceSoftwareVersionDto();\n dto.setImageUrl(EXISTING_IMAGE_URL);\n\n this.exception.expect(Vmidc... | {
"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/ApplianceSoftwareVersionDtoValidator.java",
"ide... | {
"body": "@Override\n public void validateForCreate(ApplianceSoftwareVersionDto dto) throws Exception {\n checkForNullFields(dto);\n\n checkFieldLength(dto);\n\n ApplianceSoftwareVersion asv = ApplianceSoftwareVersionEntityMgr.findByImageUrl(this.em, dto.getImageUrl());\n if (asv != nu... | {
"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_96 | {
"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_WhenProviderReady_ReturnsSuccess() throws Exception {\n // Arrange.\n DryRunRequest<VirtualizationConnectorRequest> request = VirtualizationConnectorUtilTestData.generateK8sVCWithSDN();\n\n List<ErrorTyp... | {
"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_79 | {
"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 @SuppressWarnings(\"unchecked\")\n public void testKillProcess_WithLongRunningProcessId_UsesForcedShutdown() throws Exception {\n // Arrange.\n final boolean[] testPassed = new boolean[1];\n final List<String> gentleShutdownIterationsCounter = new ArrayList<>();\n\n ... | {
"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 void killProcess(String oldPid) throws InterruptedException {\n // Making sure that old process also went away.\n int retries = 10; // 10 x 500ms = 5 seconds.\n boolean pidFound = false;\n while (retries > 0) {\n List<String> lines = new ArrayList<>();\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_236 | {
"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": "@Ignore\n @Test\n public void testTaskDependencyExecutionOrder() throws Exception {\n // Test first level parallel followed by sequential parallel tasks\n this.tg = new TaskGraph();\n this.tg.addTask(this.A);\n this.tg.addTask(this.B);\n this.tg.addTask(this.C, this... | {
"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_148 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule public",
"original_string": "@Rule public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "em",
... | {
"body": "@Test\n public void testExecuteTransaction_WithImageWithApplianceVersion_ExpectsNoUpdate() throws Exception {\n //Arrange.\n OsImageReference imageReference = new OsImageReference(this.vs, \"region\", \"refId\");\n this.vs.addOsImageReference(imageReference);\n UpdateVsWithIm... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(UpdateVsWithImageVersionTask.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(UpdateVsWithImageVersionTask.class);",
"type": "Logger",
"var_name": "L... | {
"body": "public UpdateVsWithImageVersionTask create(VirtualSystem vs) {\n UpdateVsWithImageVersionTask task = new UpdateVsWithImageVersionTask();\n task.vs = vs;\n task.name = task.getName();\n task.dbConnectionManager = this.dbConnectionManager;\n task.txBroadcastUtil = this.txBr... | {
"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_216 | {
"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 testValidateForUpdate_WhenDistributedApplianceNotFound_ThrowsValidationException() throws Exception {\n // Arrange.\n Long notFoundDaId = 2000L;\n DistributedApplianceDto daDto = createDistributedApplianceDto();\n daDto.setId(notFoundDaId);\n\n this... | {
"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 DistributedAppliance validateForUpdate(DistributedApplianceDto dto) throws Exception {\n BaseDtoValidator.checkForNullId(dto);\n\n DistributedAppliance da = this.em.find(DistributedAppliance.class, dto.getId());\n\n if (da == null) {\n\n throw new Vmidc... | {
"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_59 | {
"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 testEncryptAESGCM_withNullIV_throwsEncryptionException() throws EncryptionException {\n // Arrange.\n byte[] iv = null;\n\n // Assert.\n this.exception.expect(EncryptionException.class);\n\n // Act.\n new EncryptionUtil().encryptAESGCM(this.p... | {
"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 byte[] encryptAESGCM(byte[] plainText, SecretKey key, byte[] iv, byte[] aad) throws EncryptionException {\n return new AESGCMEncryption().encrypt(plainText, key, iv, aad);\n }",
"class_method_signature": "EncryptionUtil.encryptAESGCM(byte[] plainText, SecretKey key, byte[]... | {
"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_241 | {
"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 testSkippedTasks() throws Exception {\n Task A = new FailedTask(\"A-Failed\");\n Task B = new EmptyTask(\"B\");\n Task C = new EmptyTask(\"C\");\n Task D = new EmptyTask(\"D\");\n Task E = new EmptyTask(\"E\");\n Task F = new EmptyTask(\"F\")... | {
"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_187 | {
"fields": [
{
"declarator": "em",
"modifier": "@Mock\n\tprotected",
"original_string": "@Mock\n\tprotected EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "tx",
"modifier": "@Mock\n\tprotected",
"original_string": "@Mock\n\... | {
"body": "@Test\n\tpublic void testExecute_WhenCreateNetworkRedirectionApiFails_ThrowsTheUnhandledException() throws Exception {\n\t\t// Arrange.\n\t\tSecurityGroup sg = registerSecurityGroup(\"SG\", 1L, null);\n\n\t\twhen(this.apiFactoryServiceMock.createNetworkRedirectionApi(sg.getVirtualizationConnector()))\n\t\t... | {
"fields": [
{
"declarator": "apiFactoryService",
"modifier": "@Reference\n private",
"original_string": "@Reference\n private ApiFactoryService apiFactoryService;",
"type": "ApiFactoryService",
"var_name": "apiFactoryService"
},
{
"declarator": "portGroup",
... | {
"body": "public DeletePortGroupTask create(SecurityGroup securityGroup, NetworkElementImpl portGroup){\n DeletePortGroupTask task = new DeletePortGroupTask();\n task.securityGroup = securityGroup;\n task.portGroup = portGroup;\n task.apiFactoryService = this.apiFactoryService;\n t... | {
"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_168 | {
"fields": [
{
"declarator": "factory",
"modifier": "@InjectMocks",
"original_string": "@InjectMocks\n AllocateDAIWithSGIMembersTask factory;",
"type": "AllocateDAIWithSGIMembersTask",
"var_name": "factory"
}
],
"file": "osc-server/src/test/java/org/osc/core/broker/servic... | {
"body": "@Test\n public void testExecute_WhenSGIHasMultipleSGMembers_AllocatesDAIToVMPorts() throws Exception {\n // Arrange.\n SecurityGroup sg = new SecurityGroup(null, null, null);\n sg.addSecurityGroupMember(newSGMWithPort(VM.class, 1L));\n sg.addSecurityGroupMember(newSGMWithPort... | {
"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 AllocateDAIWithSGIMembersTask create(SecurityGroupInterface sgi, DistributedApplianceInstance dai) {\n AllocateDAIWithSGIMembersTask task = new AllocateDAIWithSGIMembersTask(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_18 | {
"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_WhenComponentStatusConditionsIsNull_ServiceNotReady() throws Exception {\n // Arrange.\n ComponentStatus componentStatus = newComponentStatus(null, null);\n componentStatus.setConditions(null);\n mockComponentStatus(componentStatus);\n\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_191 | {
"fields": [
{
"declarator": "OPENSTACK_VMPORT_ID = \"openstack-vmport-id\"",
"modifier": "private static final",
"original_string": "private static final String OPENSTACK_VMPORT_ID = \"openstack-vmport-id\";",
"type": "String",
"var_name": "OPENSTACK_VMPORT_ID"
},
{
"... | {
"body": "@Test\n public void testExecute_WithInspectionHook_ExpectFailure() throws Exception {\n // Arrange\n doThrow(new Exception()).when(this.sdnApi).updateInspectionHook(any());\n\n this.exception.expect(Exception.class);\n\n SfcFlowClassifierUpdateTask updateTask = this.task.crea... | {
"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 SfcFlowClassifierUpdateTask create(SecurityGroup securityGroup, VMPort port) {\n SfcFlowClassifierUpdateTask task = new SfcFlowClassifierUpdateTask();\n\n task.securityGroup = securityGroup;\n task.sfc = securityGroup.getServiceFunctionChain();\n task.port = port;\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_200 | {
"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_CallsSDNUpdateWithProvidedParameters_ExpectUpdate() throws Exception {\n\n // Arrange\n this.sg.setNetworkElementId(\"OLD_SFC_ID\");\n this.networkElementList = new ArrayList<>();\n\n UpdateServiceFunctionChainTask updateTask = this.task.create... | {
"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_129 | {
"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_WhenGetDeploymentNeverReturnsExpectedInstanceCount_ThrowsVmidcException() throws Exception {\n // Arrange.\n DeploymentSpec ds = createDS();\n when(this.em.find(DeploymentSpec.class, ds.getId())).thenReturn(ds);\n\n KubernetesDeployment k8sDepl... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(CheckK8sDeploymentStateTask.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(CheckK8sDeploymentStateTask.class);",
"type": "Logger",
"var_name": "LOG... | {
"body": "CheckK8sDeploymentStateTask create(DeploymentSpec ds, KubernetesDeploymentApi k8sDeploymentApi) {\n CheckK8sDeploymentStateTask task = new CheckK8sDeploymentStateTask();\n task.dbConnectionManager = this.dbConnectionManager;\n task.txBroadcastUtil = this.txBroadcastUtil;\n task.... | {
"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_4 | {
"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 testDeleteDeployment_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 void deleteDeployment(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 no... | {
"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_152 | {
"fields": [
{
"declarator": "em",
"modifier": "public",
"original_string": "public EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "novaApiMock",
"modifier": "@Mock\n public",
"original_string": "@Mock\n public Openst... | {
"body": "@Test\n public void testExecuteTransaction_WithVariousDeploymentSpecs_ExpectsCorrectTaskGraph() throws Exception {\n // Arrange.\n this.factoryTask.osSvaCreateMetaTask = new OsSvaCreateMetaTask();\n this.factoryTask.osDAIConformanceCheckMetaTask = new OsDAIConformanceCheckMetaTask()... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(DSUpdateOrDeleteMetaTask.class)",
"modifier": "private static final",
"original_string": "private static final Logger log = LoggerFactory.getLogger(DSUpdateOrDeleteMetaTask.class);",
"type": "Logger",
"var_name": "log"
... | {
"body": "public DSUpdateOrDeleteMetaTask create(DeploymentSpec ds, Endpoint endPoint) {\n DSUpdateOrDeleteMetaTask task = new DSUpdateOrDeleteMetaTask();\n task.ds = ds;\n task.endPoint = endPoint;\n task.name = task.getName();\n\n task.osSvaCreateMetaTask = this.osSvaCreateMetaTa... | {
"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_34 | {
"fields": [
{
"declarator": "validDaNames = Lists.newArrayList(\"arv-1\",\"arv-56789-123\")",
"modifier": "private static final",
"original_string": "private static final List<String> validDaNames = Lists.newArrayList(\"arv-1\",\"arv-56789-123\");",
"type": "List<String>",
"var_nam... | {
"body": "@Test\n public void testValidateDaName() {\n for(String item : validDaNames) {\n assertTrue(ValidateUtil.validateDaName(item));\n }\n\n for(String item : invalidDaNames) {\n assertFalse(ValidateUtil.validateDaName(item));\n }\n }",
"class_method_sig... | {
"fields": [
{
"declarator": "DEFAULT_MAX_LEN = 155",
"modifier": "public static final",
"original_string": "public static final int DEFAULT_MAX_LEN = 155;",
"type": "int",
"var_name": "DEFAULT_MAX_LEN"
}
],
"file": "osc-server/src/main/java/org/osc/core/broker/util/Validate... | {
"body": "public static boolean validateDaName(String name) {\n\n char ch = name.charAt(0);\n if (name.length() > 13 || name.length() < 1) {\n return false;\n }\n if (!(ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122)) {\n return false;\n }\n if (hasInval... | {
"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_105 | {
"fields": [
{
"declarator": "logging",
"modifier": "@Mock",
"original_string": "@Mock\n LoggingApi logging;",
"type": "LoggingApi",
"var_name": "logging"
},
{
"declarator": "archiveUtil",
"modifier": "@InjectMocks",
"original_string": "@InjectMocks\n ... | {
"body": "@Test\n public void testUnzip_withValidZip_expectedSuccess() throws IOException {\n //Arrange\n prepareValidZipFile();\n //Act.\n this.archiveUtil.unzip(FILE_ABSOLUTE,PATH);\n //Assert.\n this.archiveMap.entrySet()\n .stream()\n .forEach(k ->\n ... | {
"fields": [
{
"declarator": "logging",
"modifier": "@Reference\n private",
"original_string": "@Reference\n private LoggingApi logging;",
"type": "LoggingApi",
"var_name": "logging"
},
{
"declarator": "log = LoggerFactory.getLogger(ArchiveUtil.class)",
"mo... | {
"body": "@Override\n public void unzip(String inputFile, String destination) throws IOException {\n // TODO: barteks - use system unzip instead of java zip stream.\n FileInputStream fis = new FileInputStream(inputFile);\n ZipEntry entry;\n int entries = 0;\n long total = BUFFER... | {
"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_63 | {
"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 testAuthenticateInvalidTokensLength() {\n Mockito.when(this.mockRequest.getHeaderString(\"Authorization\")).thenReturn(\"abc\\\\s+xyz\\\\+s\");\n this.authUtil.authenticate(this.mockRequest, USER, ENCRYPTED_PASSWORD);\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 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_113 | {
"fields": [
{
"declarator": "NO_SUCH_DA_ID = 1L",
"modifier": "private final static",
"original_string": "private final static Long NO_SUCH_DA_ID = 1L;",
"type": "Long",
"var_name": "NO_SUCH_DA_ID"
},
{
"declarator": "MARKED_FOR_DELETE_DA_ID = 2L",
"modifier": "... | {
"body": "@Test\n public void testExec_WithVariousIds() throws Exception {\n BaseIdRequest request = new BaseIdRequest(this.daId);\n BaseJobResponse response = this.service.exec(request, this.em);\n Assert.assertNotNull(response);\n assertEquals(this.jobId, response.getJobId());\n }... | {
"fields": [
{
"declarator": "da",
"modifier": "private",
"original_string": "private DistributedAppliance da;",
"type": "DistributedAppliance",
"var_name": "da"
},
{
"declarator": "daConformJobFactory",
"modifier": "@Reference\n private",
"original_stri... | {
"body": "@Override\n protected BaseJobResponse exec(BaseIdRequest request, EntityManager em) throws Exception {\n this.da = em.find(DistributedAppliance.class, request.getId());\n\n validate(em, request.getId());\n\n Long jobId = this.daConformJobFactory.startDAConformJob(em, this.da);\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_75 | {
"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 testLoadProperties_WithAvailableConfigFile_ReturnsLoadedConfigFile() throws IOException {\n // Arrange.\n Files.write(this.regularFile.toPath(), this.sampleConfigFile.getBytes(), StandardOpenOption.APPEND);\n\n // Act.\n Properties prop = FileUtil.loadProp... | {
"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 Properties loadProperties(String propertiesFilePath) throws IOException {\n Properties prop = new Properties();\n try (FileInputStream fileInputStream = new FileInputStream(propertiesFilePath)) {\n prop.load(fileInputStream);\n }\n return prop;\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_144 | {
"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.createMgrSecurityGroupTask = new CreateMgrSecurityGroupTask();\n this.factoryTask.updateMgrSecurityGroupTask = new UpdateMgrSecurityGroupTask();\n ... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(MgrSecurityGroupCheckMetaTask.class)",
"modifier": "private static final",
"original_string": "private static final Logger log = LoggerFactory.getLogger(MgrSecurityGroupCheckMetaTask.class);",
"type": "Logger",
"var_name": ... | {
"body": "public MgrSecurityGroupCheckMetaTask create(VirtualSystem vs) {\n MgrSecurityGroupCheckMetaTask task = new MgrSecurityGroupCheckMetaTask();\n task.vs = vs;\n task.name = task.getName();\n task.createMgrSecurityGroupTask = this.createMgrSecurityGroupTask;\n task.updateMgrS... | {
"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_22 | {
"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_WithNullLabel_ThrowsIllegalArgumentException() throws Exception {\n // Arrange.\n this.exception.expect(IllegalArgumentException.class);\n\n // Act.\n this.service.getPodsByLabel(null);\n }",
"class_method_signature": "KubernetesPod... | {
"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_145 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule public",
"original_string": "@Rule public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "em",
... | {
"body": "@Test\n public void testExecuteTransaction_WithImage_DeletesAndUpdatesVS() throws Exception {\n //Arrange.\n DeleteImageReferenceTask task = this.factory.create(this.imageReference, this.vs);\n\n //Act.\n task.execute();\n\n //Assert.\n Mockito.verify(this.em).r... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(DeleteImageReferenceTask.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(DeleteImageReferenceTask.class);",
"type": "Logger",
"var_name": "LOG"
... | {
"body": "public DeleteImageReferenceTask create(OsImageReference imageReference, VirtualSystem vs) {\n DeleteImageReferenceTask task = new DeleteImageReferenceTask();\n task.imageReference = imageReference;\n task.vs = vs;\n task.name = task.getName();\n task.dbConnectionManager =... | {
"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_23 | {
"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_WhenK8ClientThrowsKubernetesClientException_ThrowsVmidcException() throws Exception {\n // Arrange.\n this.exception.expect(VmidcException.class);\n when(this.fabric8Client.pods()).thenThrow(new KubernetesClientException(\"\"));\n\n // A... | {
"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_112 | {
"fields": [
{
"declarator": "em",
"modifier": "@Mock\n\tprivate",
"original_string": "@Mock\n\tprivate EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "keyStoreProviderMock",
"modifier": "@Mock\n\tprivate",
"original_string... | {
"body": "@Test\n public void testIsValidEncryptedBackupFilename_withInvalidFilename_fails() {\n\t\t// Arrange.\n\t\tString givenFilename = \"/example/filename.dbb123\";\n\t\t// Act.\n boolean result = this.target.isValidEncryptedBackupFilename(givenFilename);\n\t\t// Assert.\n assertFalse(result);\... | {
"fields": [
{
"declarator": "DEFAULT_BACKUP_FILE_NAME = \"BrokerServerDBBackup\"",
"modifier": "protected static final",
"original_string": "protected static final String DEFAULT_BACKUP_FILE_NAME = \"BrokerServerDBBackup\";",
"type": "String",
"var_name": "DEFAULT_BACKUP_FILE_NAME"... | {
"body": "@Override\n public boolean isValidEncryptedBackupFilename(String filename) {\n \treturn (\".\" + FilenameUtils.getExtension(filename)).equals(EXT_ENCRYPTED_BACKUP);\n }",
"class_method_signature": "BackupFileService.isValidEncryptedBackupFilename(String filename)",
"constructor": false,
"ful... | {
"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_74 | {
"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_WithInvalidPath_ReturnsEmptyList() throws IOException {\n // Act.\n File[] fileList = FileUtil.getFileListFromDirectory(\"testInvalidDir\");\n\n // Assert.\n Assert.assertEquals(\"File list should contain empty list\", 0, fileL... | {
"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_104 | {
"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_WhenMqClientIsConnected_ReturnsSuccessful() throws Throwable {\n // Arrange.\n DryRunRequest<VirtualizationConnectorRequest> request = ... | {
"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_62 | {
"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 testAuthenticateInvalidTokensNull() {\n Mockito.when(this.mockRequest.getHeaderString(\"Authorization\")).thenReturn(\"\");\n this.authUtil.authenticate(this.mockRequest, USER, ENCRYPTED_PASSWORD);\n }",
"class_method_signa... | {
"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_153 | {
"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_WhenCreateNetworkRedirectionApiFails_ThrowsTheUnhandledException() throws Exception {\n // Arrange.\n DistributedApplianceInstance dai = registerNewDAI(1L);\n\n when(this.apiFactoryServiceMock.createNetworkRedirectionApi(dai)).thenThrow(new IllegalSta... | {
"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_35 | {
"fields": [
{
"declarator": "validDaNames = Lists.newArrayList(\"arv-1\",\"arv-56789-123\")",
"modifier": "private static final",
"original_string": "private static final List<String> validDaNames = Lists.newArrayList(\"arv-1\",\"arv-56789-123\");",
"type": "List<String>",
"var_nam... | {
"body": "@Test\n public void testValidateFieldLength() {\n HashMap<String, String> map = new HashMap<>();\n map.put(\"foo1\", \"foo_value1\");\n map.put(\"foo2\", \"foo_value2_longer\");\n map.put(\"foo3\", \"foo_\");\n map.put(\"foo4\", \"foo_value4_veryLong_value\");\n\n ... | {
"fields": [
{
"declarator": "DEFAULT_MAX_LEN = 155",
"modifier": "public static final",
"original_string": "public static final int DEFAULT_MAX_LEN = 155;",
"type": "int",
"var_name": "DEFAULT_MAX_LEN"
}
],
"file": "osc-server/src/main/java/org/osc/core/broker/util/Validate... | {
"body": "public static void validateFieldLength(Map<String, String> map, int maxLen) throws VmidcBrokerInvalidEntryException {\n\n for (Entry<String, String> entry : map.entrySet()) {\n\n String field = entry.getKey();\n String value = entry.getValue();\n\n if (value != null ... | {
"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_5 | {
"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 testDeleteDeployment_WhenK8sReturnsNull_DoesNothing() 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 void deleteDeployment(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 no... | {
"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_128 | {
"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_WhenGetDeploymentReturnsNull_ThrowsVmidcException() throws Exception {\n // Arrange.\n DeploymentSpec ds = createDS();\n when(this.em.find(DeploymentSpec.class, ds.getId())).thenReturn(ds);\n registerKubernetesDeployment(ds, null);\n\n C... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(CheckK8sDeploymentStateTask.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(CheckK8sDeploymentStateTask.class);",
"type": "Logger",
"var_name": "LOG... | {
"body": "CheckK8sDeploymentStateTask create(DeploymentSpec ds, KubernetesDeploymentApi k8sDeploymentApi) {\n CheckK8sDeploymentStateTask task = new CheckK8sDeploymentStateTask();\n task.dbConnectionManager = this.dbConnectionManager;\n task.txBroadcastUtil = this.txBroadcastUtil;\n task.... | {
"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_201 | {
"fields": [
{
"declarator": "OPENSTACK_VMPORT_ID = \"openstack-vmport-id\"",
"modifier": "private static final",
"original_string": "private static final String OPENSTACK_VMPORT_ID = \"openstack-vmport-id\";",
"type": "String",
"var_name": "OPENSTACK_VMPORT_ID"
},
{
"... | {
"body": "@Test\n public void testExecute_CreateInspectionHook_ExpectUpdate() throws Exception {\n // Arrange\n when(this.sdnApi.installInspectionHook(any(), any(), any(), any(), any(), any()))\n .thenReturn(INSPECTION_HOOK_ID);\n\n SfcFlowClassifierCreateTask createTask = this... | {
"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 SfcFlowClassifierCreateTask create(SecurityGroup securityGroup, VMPort port) {\n SfcFlowClassifierCreateTask task = new SfcFlowClassifierCreateTask();\n\n task.securityGroup = securityGroup;\n task.sfc = securityGroup.getServiceFunctionChain();\n task.port = port;\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_19 | {
"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_WhenComponentStatusHealthyConditionNotFound_ServiceNotReady() throws Exception {\n // Arrange.\n ComponentStatus componentStatus = newComponentStatus(\"other_condition\", \"True\");\n mockComponentStatus(componentStatus);\n\n // Act.\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_190 | {
"fields": [
{
"declarator": "OPENSTACK_VMPORT_ID = \"openstack-vmport-id\"",
"modifier": "private static final",
"original_string": "private static final String OPENSTACK_VMPORT_ID = \"openstack-vmport-id\";",
"type": "String",
"var_name": "OPENSTACK_VMPORT_ID"
},
{
"... | {
"body": "@Test\n public void testExecute_WithInspectionHook_ExpectUpdate() throws Exception {\n // Arrange\n SfcFlowClassifierUpdateTask updateTask = this.task.create(this.sg, this.port);\n\n // Act.\n updateTask.execute();\n\n // Assert\n verify(this.sdnApi, times(1)).u... | {
"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 SfcFlowClassifierUpdateTask create(SecurityGroup securityGroup, VMPort port) {\n SfcFlowClassifierUpdateTask task = new SfcFlowClassifierUpdateTask();\n\n task.securityGroup = securityGroup;\n task.sfc = securityGroup.getServiceFunctionChain();\n task.port = port;\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_186 | {
"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_WhenSGIHasSingleSGMemberWithMultiplePorts_DeallocatesDAIsOfVMPorts() throws Exception {\n // Arrange.\n SecurityGroup sg = new SecurityGroup(null, null, null);\n SecurityGroupMember sgm = newSGMVmWithoutPort(1L);\n sg.addSecurityGroupMember(sgm... | {
"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_169 | {
"fields": [
{
"declarator": "factory",
"modifier": "@InjectMocks",
"original_string": "@InjectMocks\n AllocateDAIWithSGIMembersTask factory;",
"type": "AllocateDAIWithSGIMembersTask",
"var_name": "factory"
}
],
"file": "osc-server/src/test/java/org/osc/core/broker/servic... | {
"body": "@Test\n public void testExecute_WhenSGIHasSingleSGMemberWithMultiplePorts_AllocatesDAIToVMPorts() throws Exception {\n // Arrange.\n SecurityGroup sg = new SecurityGroup(null, null, null);\n SecurityGroupMember sgm = newSGMVmWithoutPort(1L);\n sg.addSecurityGroupMember(sgm);\... | {
"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 AllocateDAIWithSGIMembersTask create(SecurityGroupInterface sgi, DistributedApplianceInstance dai) {\n AllocateDAIWithSGIMembersTask task = new AllocateDAIWithSGIMembersTask(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_240 | {
"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 testTaskInputOutput() throws Exception {\n OutputTask A = new OutputTask(\"A-OutputTask\");\n InputTask B = new InputTask(\"B-Input\");\n InputTask C = new InputTask(\"C-Input\");\n\n this.tg = new TaskGraph();\n this.tg.addTask(A);\n this.tg... | {
"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_58 | {
"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 testEncryptAESGCM_withNullKey_throwsEncryptionException() throws EncryptionException {\n // Arrange.\n SecretKey key = null;\n\n // Assert.\n this.exception.expect(EncryptionException.class);\n\n // Act.\n new EncryptionUtil().encryptAESGCM(t... | {
"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 byte[] encryptAESGCM(byte[] plainText, SecretKey key, byte[] iv, byte[] aad) throws EncryptionException {\n return new AESGCMEncryption().encrypt(plainText, key, iv, aad);\n }",
"class_method_signature": "EncryptionUtil.encryptAESGCM(byte[] plainText, SecretKey key, byte[]... | {
"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_217 | {
"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 testValidateForUpdate_WhenManagerConnectorIdMismatches_ThrowsValidationException() throws Exception {\n // Arrange.\n DistributedApplianceDto daDto = createDistributedApplianceDto();\n daDto.setId(this.da.getId());\n daDto.setName(DA_NAME_EXISTING_DA);\n ... | {
"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 DistributedAppliance validateForUpdate(DistributedApplianceDto dto) throws Exception {\n BaseDtoValidator.checkForNullId(dto);\n\n DistributedAppliance da = this.em.find(DistributedAppliance.class, dto.getId());\n\n if (da == null) {\n\n throw new Vmidc... | {
"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_149 | {
"fields": [
{
"declarator": "exception = ExpectedException.none()",
"modifier": "@Rule public",
"original_string": "@Rule public ExpectedException exception = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "exception"
},
{
"declarator": "em",
... | {
"body": "@Test\n public void testExecuteTransaction_WithImageWithoutApplianceVersion_ExpectsUpdate() throws Exception {\n //Arrange.\n OsImageReference imageReference = new OsImageReference(this.vs, \"region\", \"refId\");\n this.vs.addOsImageReference(imageReference);\n imageReferenc... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(UpdateVsWithImageVersionTask.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(UpdateVsWithImageVersionTask.class);",
"type": "Logger",
"var_name": "L... | {
"body": "public UpdateVsWithImageVersionTask create(VirtualSystem vs) {\n UpdateVsWithImageVersionTask task = new UpdateVsWithImageVersionTask();\n task.vs = vs;\n task.name = task.getName();\n task.dbConnectionManager = this.dbConnectionManager;\n task.txBroadcastUtil = this.txBr... | {
"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_237 | {
"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 testConcurrentGraphModification() throws Exception {\n String jobName = \"Test-Concurrent-Graph-Modification\";\n this.tg = new TaskGraph();\n\n for (int i = 0; i < 200; i++) {\n this.tg.addTask(new EmptyTask(\"Task \" + i));\n }\n\n this.... | {
"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_97 | {
"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_WhenSdnControllerStatusFail_ReturnsErrorTypeException() throws Exception {\n // Arrange.\n this.exception.expect(ErrorTypeException.class);\n\n DryRunRequest<VirtualizationConnec... | {
"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_78 | {
"fields": [
{
"declarator": "networkSettingsApi",
"modifier": "private",
"original_string": "private NetworkSettingsApi networkSettingsApi;",
"type": "NetworkSettingsApi",
"var_name": "networkSettingsApi"
}
],
"file": "osc-server/src/test/java/org/osc/core/broker/util/netwo... | {
"body": "@Test\n public void testGetDefaultGateway_With_IPCommand_Exec_ReturnDefaultGateway() throws IOException\n {\n PowerMockito.mockStatic(ServerUtil.class);\n PowerMockito.when(ServerUtil.execWithLog(Matchers.anyString(), Matchers.anyList())).thenReturn(0);\n String defaultGateway = ... | {
"fields": [
{
"declarator": "NETWORK_RESOLV = \"/etc/resolv.conf\"",
"modifier": "private final",
"original_string": "private final String NETWORK_RESOLV = \"/etc/resolv.conf\";",
"type": "String",
"var_name": "NETWORK_RESOLV"
},
{
"declarator": "log = LoggerFactory.g... | {
"body": "String getDefaultGateway() {\n\n String defaultGateway = \"\";\n String[] cmd = { \"/bin/sh\", \"-c\", \"ip route|grep default|tr -s ' ' |cut -d' ' -f3\" };\n List<String> outlines = new ArrayList<>();\n\n int exitCode = ServerUtil.execWithLog(cmd, outlines);\n if (exitCo... | {
"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_221 | {
"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_UsingValidNewImage_Suceeds() throws Exception {\n // Arrange.\n ApplianceSoftwareVersionDto dto = newApplianceSoftwareVersionDto();\n\n // Act.\n this.validator.validateForCreate(dto);\n }",
"class_method_signature": "ApplianceSo... | {
"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/ApplianceSoftwareVersionDtoValidator.java",
"ide... | {
"body": "@Override\n public void validateForCreate(ApplianceSoftwareVersionDto dto) throws Exception {\n checkForNullFields(dto);\n\n checkFieldLength(dto);\n\n ApplianceSoftwareVersion asv = ApplianceSoftwareVersionEntityMgr.findByImageUrl(this.em, dto.getImageUrl());\n if (asv != nu... | {
"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_81 | {
"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_WithProperData_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 \" + this.oldPro... | {
"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_108 | {
"fields": [
{
"declarator": "em",
"modifier": "@Mock\n\tprivate",
"original_string": "@Mock\n\tprivate EntityManager em;",
"type": "EntityManager",
"var_name": "em"
},
{
"declarator": "keyStoreProviderMock",
"modifier": "@Mock\n\tprivate",
"original_string... | {
"body": "@Test\n public void testIsValidBackupFilename_withInvalidBackupFilename_fails() {\n\t\t// Arrange.\n\t\tString givenFilename = \"/example/filename.zip1\";\n\t\t// Act.\n boolean result = this.target.isValidBackupFilename(givenFilename);\n\t\t// Assert.\n assertFalse(result);\n }",
"cl... | {
"fields": [
{
"declarator": "DEFAULT_BACKUP_FILE_NAME = \"BrokerServerDBBackup\"",
"modifier": "protected static final",
"original_string": "protected static final String DEFAULT_BACKUP_FILE_NAME = \"BrokerServerDBBackup\";",
"type": "String",
"var_name": "DEFAULT_BACKUP_FILE_NAME"... | {
"body": "@Override\n public boolean isValidBackupFilename(String filename) {\n \treturn isValidZipBackupFilename(filename) ||\n \t\t\tisValidEncryptedBackupFilename(filename);\n }",
"class_method_signature": "BackupFileService.isValidBackupFilename(String filename)",
"constructor": false,
"full_si... | {
"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_9 | {
"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_WithReplicaCountLowerThanOne_ThrowsIllegalArgumentException() throws Exception {\n // Arrange.\n this.exception.expect(IllegalArgumentException.class);\n\n // Act.\n this.deploymentApi.updateDeploymentReplicaCount(\"1234\",... | {
"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_39 | {
"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_fileExists_expectedSuccess() throws IOException {\n //Arrange.\n Path file = Paths.get(DIR_PATH + File.separator + FILE_NAME);\n Path backup = Paths.get(DIR_PATH + File.separator + FILE_NAME + \".org\");\n Writer logs = getLogs();\n ... | {
"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_42 | {
"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 writeInputStreamToFile_fileExists_expectedSuccess() throws IOException {\n //Arrange.\n Path file = Paths.get(DIR_PATH + File.separator + FILE_NAME);\n Path backup = Paths.get(DIR_PATH + File.separator + FILE_NAME + \".org\");\n Writer logs = getLogs();\n ... | {
"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 writeInputStreamToFile(InputStream is, 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... | {
"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_124 | {
"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.deleteOrCleanK8sDAITask = new CleanK8sDAITask();\n this.factoryTask.createOrUpdateK8sDAITask = new CreateOrUpdateK8sDAITask();\n ... | {
"fields": [
{
"declarator": "deleteOrCleanK8sDAITask",
"modifier": "@Reference",
"original_string": "@Reference\n CleanK8sDAITask deleteOrCleanK8sDAITask;",
"type": "CleanK8sDAITask",
"var_name": "deleteOrCleanK8sDAITask"
},
{
"declarator": "createOrUpdateK8sDAITas... | {
"body": "public ConformK8sDeploymentPodsMetaTask create(DeploymentSpec ds, KubernetesPodApi k8sPodApi) {\n ConformK8sDeploymentPodsMetaTask task = new ConformK8sDeploymentPodsMetaTask();\n task.deleteOrCleanK8sDAITask = this.deleteOrCleanK8sDAITask;\n task.createOrUpdateK8sDAITask = this.create... | {
"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_15 | {
"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 testCreateDeployment_WithValidDeployment_DeploymentCreated() throws Exception {\n // Arrange.\n KubernetesDeployment deployment =\n new KubernetesDeployment(\"name\", \"namespace\", \"uid\", 2, \"imageName\", null);\n\n String deploymentUid = UUID.... | {
"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 String createDeployment(KubernetesDeployment deployment) throws VmidcException {\n if (deployment == null) {\n throw new IllegalArgumentException(\"The deployment should not be null\");\n }\n\n try {\n Deployment newDeployment = new DeploymentBuilder()\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_173 | {
"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_WhenSGIHasNoNetworkElementId_NothingToRemove() throws Exception {\n // Arrange.\n SecurityGroupInterface sgi = registerNewSGI(1L);\n sgi.setNetworkElementId(null);\n\n RemovePortGroupHookTask task = this.factory.create(sgi);\n\n // Act.\... | {
"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_165 | {
"fields": [
{
"declarator": "factory",
"modifier": "@InjectMocks",
"original_string": "@InjectMocks\n AllocateDAIWithSGIMembersTask factory;",
"type": "AllocateDAIWithSGIMembersTask",
"var_name": "factory"
}
],
"file": "osc-server/src/test/java/org/osc/core/broker/servic... | {
"body": "@Test\n public void testExecute_WhenSGIHasVMSGMember_AllocatesDAIToVMPort() throws Exception {\n // Arrange.\n SecurityGroup sg = new SecurityGroup(null, null, null);\n sg.addSecurityGroupMember(newSGMWithPort(VM.class, 1L));\n\n SecurityGroupInterface sgi = registerNewSGI(sg... | {
"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 AllocateDAIWithSGIMembersTask create(SecurityGroupInterface sgi, DistributedApplianceInstance dai) {\n AllocateDAIWithSGIMembersTask task = new AllocateDAIWithSGIMembersTask(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_54 | {
"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_WithEmptyMessage_ExpectsEmptyMessage() throws EncryptionException {\n String decryption = new EncryptionUtil().decryptAESCTR(\"\");\n assertEquals(\"\", decryption);\n }",
"class_method_signature": "EncryptionUtilTest.testDecryptAesCtr_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 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_132 | {
"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_WhenUpdatingSucceeds_K8sDeploymentIsUpdatedWithNewInstanceCount() throws Exception {\n // Arrange.\n VirtualizationConnector vc = new VirtualizationConnector();\n vc.setProviderIpAddress(\"1.1.1.1\");\n VirtualSystem vs = new VirtualSystem(null... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(UpdateK8sDeploymentTask.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(UpdateK8sDeploymentTask.class);",
"type": "Logger",
"var_name": "LOG"
},... | {
"body": "UpdateK8sDeploymentTask create(DeploymentSpec ds, KubernetesDeploymentApi k8sDeploymentApi) {\n UpdateK8sDeploymentTask task = new UpdateK8sDeploymentTask();\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"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.